• DİKKAT

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

ComboBox ve ListBox ile filtreleme

Katılım
26 Ocak 2006
Mesajlar
757
Excel Vers. ve Dili
Office 365 İngilizce 64 Bit
ComboBox da kategori isimlerinin benzersiz görünmesini ve ComboBox da yapılan seçime göre ListBox da ürünlerin görünmesini istiyorum. Yardım lütfen.
 

Ekli dosyalar

Diğer kodlamalara bakarak becerdim galiba...

Kod:
Private Sub ComboBox1_Change()
Dim k As Range, adrs As String, j As Byte, a As Long, myarr()
ReDim myarr(1 To 7, 1 To 1)
With Worksheets("Personel")
    Me.ListBox1.RowSource = vbNullString
    If .FilterMode Then .ShowAllData
    Set k = .Range("B2:B65536").Find(ComboBox1.Text & "*", , xlValues, xlWhole)
    If Not k Is Nothing Then
        adrs = k.Address
        Do
            a = a + 1
            ReDim Preserve myarr(1 To 7, 1 To a)
            For j = 1 To 7
                myarr(j, a) = .Cells(k.Row, j).Value
            Next j
            Set k = .Range("B2:B65536").FindNext(k)
        Loop While Not k Is Nothing And k.Address <> adrs
        ListBox1.Column = myarr
    End If
End With
End Sub
Kod:
Private Sub UserForm_Initialize()

ComboBox1.List = Sheets("Personel").Range("B3:B10").Value
ListBox1.List = Sheets("Personel").Range("A3:A10").Value

Dim i As Long
ComboBox1.Clear
For i = 3 To Range("B65536").End(xlUp).Row
If WorksheetFunction.CountIf(Range("B3:B" & i), Range("B" & i).Value) = 1 Then
ComboBox1.AddItem Cells(i, "B").Value
End If
Next i

End Sub
 
Kod:
Private Sub UserForm_Initialize()

ComboBox1.List = Sheets("Personel").Range("B3:B10").Value
ListBox1.List = Sheets("Personel").Range("A3:A10").Value

Dim i As Long
ComboBox1.Clear
For i = 3 To Range("B65536").End(xlUp).Row
If WorksheetFunction.CountIf(Range("B3:B" & i), Range("B" & i).Value) = 1 Then
ComboBox1.AddItem Cells(i, "B").Value
End If
Next i

End Sub

Bu kodlarla ComboBox da benzersiz olarak verileri alabiliyorum. Ancak verilerin ComboBox da harf sırasına göre sılanmasını nasıl sağlayabilirim.
 

Ekli dosyalar

Merhaba,

Arama kutusuna combobox+alfabetik yazarak arama yapın.
 
Geri
Üst