• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

filtreleme

  • Konbuyu başlatan Konbuyu başlatan erzen
  • Başlangıç tarihi Başlangıç tarihi
Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Excel sayfasında yaptığımız filtreleme işlemini userformda combobox kullanarak nasıl yapabiliriz. Teşekkürler.
 
Yanıt

Kod:
Private Sub ComboBox1_Change()
Dim sat, s As Integer
ListBox1.Clear
For sat = 1 To Cells(65536, "a").End(xlUp).Row
If Cells(sat, "a") Like ComboBox1 Then
ListBox1.AddItem
ListBox1.List(s, 0) = Cells(sat, "a")
s = s + 1
End If: Next
End Sub
Kod:
Private Sub UserForm_Initialize()
Dim sat, s As Integer
ComboBox1.Clear
For sat = 1 To Cells(65536, "a").End(xlUp).Row
If Not WorksheetFunction.CountIf(Range("a1:a" & sat), Cells(sat, "a")) > 1 Then
ComboBox1.AddItem
ComboBox1.List(s, 0) = Cells(sat, "a")
s = s + 1
End If: Next
End Sub
 

Ekli dosyalar

İlginiz için teşekkürler. Ancak listbox kullanmadan nasıl yaparız. Yani comboboxta seçtiğim değer excel sayfasında filtrelenmiş olacak.
 
Yanıt

Kod:
Private Sub ComboBox1_Change()
[a1].Select
If ComboBox1 = "" Then
Selection.AutoFilter field:=1
Exit Sub: End If
Selection.AutoFilter field:=1, Criteria1:=ComboBox1
End Sub
Kod:
Private Sub UserForm_Initialize()
Dim sat, s As Integer
ComboBox1.Clear
For sat = 1 To Cells(65536, "a").End(xlUp).Row
If Not WorksheetFunction.CountIf(Range("a1:a" & sat), Cells(sat, "a")) > 1 Then
ComboBox1.AddItem
ComboBox1.List(s, 0) = Cells(sat, "a")
s = s + 1
End If: Next
End Sub
 

Ekli dosyalar

Teşekkürler.
 
Son düzenleme:
Geri
Üst