Merhaba.Müsait olsunca kodları kısaltırım bir sub içine alıp.
Private Sub ListBox1_Click()
Dim dic As Object, veri, aranan As String
Set dic = CreateObject("Scripting.dictionary")
With Sayfa2
veri = .Range("A2:C" & .Range("A" & Rows.Count).End(3).Row).Value
For i = LBound(veri) To UBound(veri)
aranan = veri(i, 2)
If veri(i, 1) = ListBox1.Value Then
If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
End If
Next
End With
With ListBox2
.Clear
ListBox3.Clear
.List = dic.keys
End With
Set dic = Nothing: Erase veri
End Sub
Private Sub ListBox2_Click()
Dim dic As Object, veri, aranan As String
If ListBox1.ListIndex = -1 Then
ListBox3.Clear
Exit Sub
End If
Set dic = CreateObject("Scripting.dictionary")
With Sayfa2
veri = .Range("A2:C" & .Range("A" & Rows.Count).End(3).Row).Value
For i = LBound(veri) To UBound(veri)
aranan = veri(i, 3)
If veri(i, 1) & "|" & veri(i, 2) = ListBox1.Value & "|" & ListBox2.Value Then
If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
End If
Next
End With
With ListBox3
.Clear
.List = dic.keys
End With
Set dic = Nothing: Erase veri
End Sub
Private Sub TextBox1_Change()
Dim dic As Object, veri, aranan As String
Set dic = CreateObject("Scripting.dictionary")
With Sayfa2
veri = .Range("A2:A" & .Range("A" & Rows.Count).End(3).Row).Value
For i = LBound(veri) To UBound(veri)
aranan = veri(i, 1)
' If LCase(veri(i, 1)) Like "*" & LCase(TextBox1.Value) & "*" Then 'icerik arama
If LCase(veri(i, 1)) Like LCase(TextBox1.Value) & "*" Then 'bastan arama
If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
End If
Next
End With
With ListBox1
.Clear
.List = dic.keys
End With
Set dic = Nothing: Erase veri
End Sub
Private Sub UserForm_Initialize()
Dim dic As Object, veri, aranan As String
Set dic = CreateObject("Scripting.dictionary")
With Sayfa2
veri = .Range("A2:C" & .Range("A" & Rows.Count).End(3).Row).Value
For i = LBound(veri) To UBound(veri)
aranan = veri(i, 1)
If Not dic.exists(aranan) Then If Not dic.exists(aranan) Then dic.Add aranan, ""
Next
End With
With ListBox1
.Clear
.List = dic.keys
End With
Set dic = Nothing: Erase veri
TextBox1.SetFocus
End Sub
Kitap11.rar
(Dosya Boyutu: 1,96 MB | İndirme Sayısı: 5)