filtreleme

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.
 

N.Ziya Hiçdurmaz

Özel Üye
Katılım
28 Nisan 2007
Mesajlar
2,218
Excel Vers. ve Dili
Office 2013 TR / 32 Bit
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

Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
İ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.
 

N.Ziya Hiçdurmaz

Özel Üye
Katılım
28 Nisan 2007
Mesajlar
2,218
Excel Vers. ve Dili
Office 2013 TR / 32 Bit
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

Katılım
12 Temmuz 2007
Mesajlar
133
Excel Vers. ve Dili
excel 2007 türkçe
Teşekkürler.
 
Son düzenleme:
Üst