Makro Kod Listesi
Excel de kullanılan Makro Kodlarının Listesi


userform 2) userforma alt simge durumunu küçültme ve ekranı kapla butonu ekleme

ID : 2281
ISLEM : userform 2) userforma alt simge durumunu küçültme ve ekranı kapla butonu ekleme
MAKRO KODU : Private Declare Function FindWindowA Lib "User32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function EnableWindow Lib "User32" _ (ByVal hWnd As Long, ByVal bEnable As Long) As Long Private Declare Function GetWindowLongA Lib "User32" _ (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "User32" _ (ByVal hWnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Sub UserForm_Activate() EnableWindow FindWindowA("XLMAIN", Application.Caption), 1 End Sub Private Sub UserForm_Initialize() Dim hWnd As Long hWnd = FindWindowA(vbNullString, Me.Caption) SetWindowLongA hWnd, -16, GetWindowLongA(hWnd, -16) Or &H20000 End Sub

userform 3) userformun üst sağdaki kapat butonunu gizler

ID : 2282
ISLEM : userform 3) userformun üst sağdaki kapat butonunu gizler
MAKRO KODU : Private Declare Function GetWindowLongA Lib "User32" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "User32" _ (ByVal hwnd As Long, ByVal nIndex As Long, _ ByVal dwNewLong As Long) As Long Private Declare Function FindWindowA Lib "User32" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub UserForm_Initialize() Dim hwnd As Long hwnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", _ "X", "D") & "Frame", Me.Caption) SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF End Sub

userform 4) belirli bir süre ekranda bekleyen ve daha sonra kapan user form.

ID : 2283
ISLEM : userform 4) belirli bir süre ekranda bekleyen ve daha sonra kapan user form.
MAKRO KODU : Private Sub UserForm_Activate() ' Récupération de l'heure d'affichage de la BdD TimeDebut = Timer ' Donne la main à excel pour facilité l'affichage de la BdD DoEvents ' Boucle tant que 2 secondes ne se sont pas écoulé While Timer -

userform 5) süreli userform-2

ID : 2284
ISLEM : userform 5) süreli userform-2
MAKRO KODU : Private Sub UserForm_Activate() Application.Wait Now + TimeSerial(0, 0, 3) Unload Me End Sub

userform 6) userformun başındaki kapat butonunu pasif yapar (çarpıya basınca userform kapanmaz

ID : 2285
ISLEM : userform 6) userformun başındaki kapat butonunu pasif yapar (çarpıya basınca userform kapanmaz
MAKRO KODU : Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then Cancel = True End Sub

userform 7) userformun çarpı işaretine tıklayınca mesaj kutusuyla uyarı veriyor

ID : 2286
ISLEM : userform 7) userformun çarpı işaretine tıklayınca mesaj kutusuyla uyarı veriyor
MAKRO KODU : Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = vbFormControlMenu Then MsgBox "çarpıdan kapatmak yasaktır!" Cancel = True End If End Sub

userform bekletmeli açılış

ID : 2287
ISLEM : userform bekletmeli açılış
MAKRO KODU : Private Sub UserForm_Activate() Application.Wait Now + TimeValue("00:00:02") Call kaydet Unload Me End Sub Sub kaydet() Sheets("sayfa1").Select End Sub

userform bekletmeli açılış 2

ID : 2288
ISLEM : userform bekletmeli açılış 2
MAKRO KODU : Private Sub UserForm_activate() Dim T Me.Repaint T = Timer + 10 Do While Timer -

userform çıkış iptali mesaj ile

ID : 2289
ISLEM : userform çıkış iptali mesaj ile
MAKRO KODU : Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode = 0 Then Cancel = 1 MsgBox "Lütfen butonu kullanınız", _ vbOKOnly + vbInformation, "Çıkış İptali" End If End Sub

userform da thundername alma

ID : 2290
ISLEM : userform da thundername alma
MAKRO KODU : Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" (ByVal ClassName As String, _ ByVal WindowName As String) As Long Private Sub UserForm_Click() MsgBox FindWindow("ThunderDFrame", "UserForm1") End Sub

userform da x tiklayinca excel kapansin

ID : 2291
ISLEM : userform da x tiklayinca excel kapansin
MAKRO KODU : Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) Application.Quit End Sub

userform en üstte

ID : 2292
ISLEM : userform en üstte
MAKRO KODU : Private Sub UserForm_Activate() UserForm1.Top = True End Sub

userform full ekran

ID : 2293
ISLEM : userform full ekran
MAKRO KODU : Private Sub UserForm_Initialize() With UserForm1 .Height = Application.Height .Width = Application.Width End With End Sub

userform içerisindeki nesnelerin tamamının sayısı

ID : 2294
ISLEM : userform içerisindeki nesnelerin tamamının sayısı
MAKRO KODU : MsgBox UserForm1.Controls.Count

userform kapanış örneği ***** yıldız

ID : 2295
ISLEM : userform kapanış örneği ***** yıldız
MAKRO KODU : Private Sub CommandButton3_Click() TextBox1.SetFocus OLDH = UserForm1.Height OLDW = UserForm1.Width Me.Caption = "SAYMANLIK İŞLEM FİŞİ K A P A N I Y O R..." PauseTime = 1 Start = Timer Do While Timer -

userform mükemmel bir açılış efekti

ID : 2296
ISLEM : userform mükemmel bir açılış efekti
MAKRO KODU : Option Explicit Private Declare Sub Sleep Lib "Kernel32" (ByVal Zeit As Long) Dim pir As Boolean Private Declare Function ShellExecute Lib "Shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long Private Function CallWebSite(ByVal URL As String) As Long CallWebSite = ShellExecute(0&, vbNullString, URL, vbNullString, vbNullString, vbMaximizedFocus) End Function Private Sub CommandButton1_Click() Unload Me End Sub Private Sub Label1_Click() CallWebSite (Label1.Caption) End Sub Private Sub UserForm_QueryClose(Cancel As Integer, _ CloseMode As Integer) If CloseMode = vbFormControlMenu Then MsgBox "Bu şekilde çıkmak yasak !", 64, "Information" Cancel = True End If End Sub Private Sub UserForm_Activate() Me.Width = 40 Me.Height = 180 While Me.Width -

userform otomatik boyutlandırma

ID : 2297
ISLEM : userform otomatik boyutlandırma
MAKRO KODU : Bu kodları kod sayfanın en başına yazarsan 3 Düğme oluşur.Kullanıcı istediği gibi büyütür küçültür. Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _ (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function ShowWindow Lib "user32" _ (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long Private Sub UserForm_Activate() Dim hWndForm As Long, frmStyle As Long hWndForm = FindWindow(vbNullString, Me.Caption) frmStyle = GetWindowLong(hWndForm, (-16)) frmStyle = frmStyle Or &H80000 Or &H20000 Or &H10000 SetWindowLong hWndForm, (-16), frmStyle ShowWindow hWndForm, 5 DrawMenuBar hWndForm End Sub 'Ayrı bir kod ise Userformun açılışında tam ekran olarak gelmesi. Private Sub UserForm_Initialize() With Application Me.Top = .Top Me.Left = .Left Me.Height = .Height Me.Width = .Width End With End Sub

userform otomatik boyutlandırma 2

ID : 2298
ISLEM : userform otomatik boyutlandırma 2
MAKRO KODU : Private Sub UserForm_Initialize() With Application .WindowState = xlMaximized Zoom = Int(.Width / Me.Width * 100) Width = .Width Height = .Height End With End Sub

userform sağ altta

ID : 2299
ISLEM : userform sağ altta
MAKRO KODU : Private Sub UserForm_Activate() UserForm1.Left = 600 UserForm1.Top = 425 End Sub

userform sağ üstte

ID : 2300
ISLEM : userform sağ üstte
MAKRO KODU : Private Declare Function GetSystemMetrics Lib _ "user32" (ByVal nIndex As Long) As Long Private Const SM_CYSCREEN As Long = 1 Private Const SM_CXSCREEN As Long = 0 'Position Private Declare Function FindWindow Lib "user32" Alias _ "FindWindowA" (ByVal lpClassName As String, ByVal _ lpWindowName As String) As Long Private Declare Function MoveWindow Lib "user32" (ByVal hwnd _ As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _ ByVal nHeight As Long, ByVal bRepaint As Long) As Long Private Sub UserForm_Activate() BildschirmBreite = GetSystemMetrics(SM_CXSCREEN) BildschirmHöhe = GetSystemMetrics(SM_CYSCREEN) UserformBreite = 350 UserformHöhe = 450 wHandle = FindWindow(vbNullString, Me.Caption) MoveWindow wHandle, BildschirmBreite - UserformBreite, _ 0, UserformBreite, UserformHöhe, 1 End Sub

userform sayfa1'den alsın sayfa2'ye kayıt etsin

ID : 2301
ISLEM : userform sayfa1'den alsın sayfa2'ye kayıt etsin
MAKRO KODU : Private Sub CommandButton1_Click() Application.ScreenUpdating = False dolusay = WorksheetFunction.CountA(Worksheets("1").[a1:a65000]) + 1 Worksheets("1").Cells(dolusay, "a").Value = dolusay - 1 dolusay = WorksheetFunction.CountA(Worksheets("1").[a1:a65000]) Worksheets("1").Cells(dolusay, "b").Value = cbAd.Value dolusay = WorksheetFunction.CountA(Worksheets("1").[a1:a65000]) Worksheets("1").Cells(dolusay, "c").Value = TextBox1.Value End Sub Sheets("Formunuzun Bulunmasını istediğiz sayfa").Select Application.ScreenUpdating = True End Sub

userform tam ekran

ID : 2302
ISLEM : userform tam ekran
MAKRO KODU : Private Sub UserForm_Initialize() With Application Me.Top = .Top Me.Left = .Left Me.Height = .Height Me.Width = .Width End With End Sub

userform tam ekran2

ID : 2303
ISLEM : userform tam ekran2
MAKRO KODU : Private Declare Function GetSystemMetrics Lib _ "user32" (ByVal nIndex As Long) As Long Private Const SM_CYSCREEN As Long = 1 Private Const SM_CXSCREEN As Long = 0 'Position Private Declare Function FindWindow Lib "user32" Alias _ "FindWindowA" (ByVal lpClassName As String, ByVal _ lpWindowName As String) As Long Private Declare Function MoveWindow Lib "user32" (ByVal hwnd _ As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, _ ByVal nHeight As Long, ByVal bRepaint As Long) As Long Private Sub UserForm_Activate() BildschirmBreite = GetSystemMetrics(SM_CXSCREEN) BildschirmHöhe = GetSystemMetrics(SM_CYSCREEN) wHandle = FindWindow(vbNullString, Me.Caption) MoveWindow wHandle, 0, 0, BildschirmBreite, BildschirmHöhe, 1 End Sub

userform un başlığı haraket ediyor

ID : 2304
ISLEM : userform un başlığı haraket ediyor
MAKRO KODU : Bir adet Userform oluşturun ve caption a uzun birşeyler yazın. Tabiiki birde CommandButton koyacaksınız... Sub HarfHarf (ref As UserForm1) baslik = ref.Caption ref.Caption = "" For i = 0 To Len(baslik) If i = 0 Then ref.Caption = "" current = Timer Do While Timer - current -

userform un başliği haraket ediyor

ID : 2305
ISLEM : userform un başliği haraket ediyor
MAKRO KODU : Bir adet Userform oluşturun ve caption a uzun birşeyler yazın. Bir de CommandButton Sub HarfHarf (ref As UserForm1) baslik = ref.Caption ref.Caption = "" For i = 0 To Len(baslik) If i = 0 Then ref.Caption = "" current = Timer Do While Timer - current -

userform üzerinden excel sayfasini otomatik süz

ID : 2306
ISLEM : userform üzerinden excel sayfasini otomatik süz
MAKRO KODU : Private Sub CommandButton7_Click() Selection.AutoFilter Columns("B:B").Select Selection.AutoFilter Selection.Sort Key1:=Range("B1"), Order1:=xlAscending, Header:=xlGuess, _ OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _ DataOption1:=xlSortNormal Range("E6").Select End Sub

userform ve veri seçimine göre bilgi alma

ID : 2307
ISLEM : userform ve veri seçimine göre bilgi alma
MAKRO KODU : Userforma aşağıdaki kodu; Private Sub UserForm_Initialize() For a = 2 To [c65536].End(3).Row If WorksheetFunction.CountIf(Range("c2:c" & a), Cells(a, "c")) = 1 Then ComboBox1.AddItem Cells(a, "c") Next ListBox1.ColumnCount = 9 ListBox1.ColumnWidths = "50;50;50;50;50;50;50;50;50" End Sub comboboxada aşağıdaki kodu kopyalayarak deneyin. visual basic kodu: Private Sub ComboBox1_Click() TextBox1 = WorksheetFunction.SumIf([c:c], ComboBox1, [d:d]) TextBox2 = WorksheetFunction.SumIf([c:c], ComboBox1, [g:g]) TextBox3 = WorksheetFunction.SumIf([c:c], ComboBox1, [i:i]) For sat = 2 To [c65536].End(3).Row If Cells(sat, "c") = ComboBox1 Then c = c + 1 For sut = 1 To 9 ListBox1.AddItem ListBox1.List(c - 1, sut - 1) = Cells(sat, sut) Next End If Next End Sub

userform x işaretini kaldırmak

ID : 2308
ISLEM : userform x işaretini kaldırmak
MAKRO KODU : Bu bir API'dir Private Declare Function GetWindowLongA Lib "User32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLongA Lib "User32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Private Declare Function FindWindowA Lib "User32" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Sub UserForm_Initialize() Dim hwnd As Long hwnd = FindWindowA("Thunder" & IIf(Application.Version Like "8*", "X", "D") & "Frame", Me.Caption) SetWindowLongA hwnd, -16, GetWindowLongA(hwnd, -16) And &HFFF7FFFF End Sub

userform x yok

ID : 2309
ISLEM : userform x yok
MAKRO KODU : Private Const WS_CAPTION As Long = &HC00000 Private Const WS_SYSMENU As Long = &H80000 Private Const WS_THICKFRAME As Long = &H40000 Private Const WS_MINIMIZEBOX As Long = &H20000 Private Const WS_MAXIMIZEBOX As Long = &H10000 Private Const WS_POPUP As Long = &H80000000 Private Const WS_VISIBLE As Long = &H10000000 Private Const WS_EX_DLGMODALFRAME As Long = &H1 Private Const WS_EX_APPWINDOW As Long = &H40000 Private Const WS_EX_TOOLWINDOW As Long = &H80 Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" ( _ ByVal ClassName As String, _ ByVal WindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" _ Alias "GetWindowLongA" ( _ ByVal hWnd As Long, _ ByVal Index As Long) As Long Private Declare Function SetWindowLong Lib "user32" _ Alias "SetWindowLongA" ( _ ByVal hWnd As Long, _ ByVal Index As Long, _ ByVal NewLong As Long) As Long Const GWL_STYLE = -16 Private Sub UserForm_Initialize() Dim hWnd As Long Dim Style As Long If Val(Application.Version) >= 9 Then hWnd = FindWindow("ThunderDFrame", Me.Caption) Else hWnd = FindWindow("ThunderXFrame", Me.Caption) End If Style = GetWindowLong(hWnd, GWL_STYLE) Style = (Style And Not WS_SYSMENU) SetWindowLong hWnd, GWL_STYLE, Style End Sub

userform1'in otomatik açilmasi

ID : 2310
ISLEM : userform1'in otomatik açilmasi
MAKRO KODU : Sub Auto_Open () Userform1.Show End Sub

* Görseller ve İçerik tekif hakkına sahip olabilir