Hello all
I need urgent help in this case:
1. I have multiple listboxes on a userform.
2. I have a database. 5 Different columns represnt a Category, like:
aaaaa 1 gggg 3 hhhhhh
aaaaa 1 gggg 3 hhhhhh
aaaaa 2 gggg 3 hhhhhh
aaaaa 2 hhhh 3 hhhhhh
aaaaa 3 hhhh 4 hhhhhh
aaaaa 3 hhhh 4 hhhhhh
aaaaa 3 hhhh 4 IIIIIIII
aaaaa 3 hhhh 4 JJJJJJJ
so if I select in 1.st listbox "aaaaa" then after checking how many represnt "aaaaa" I should get:
1 gggg 3 hhhhhh
1 gggg 3 hhhhhh
2 gggg 3 hhhhhh
2 hhhh 3 hhhhhh
3 hhhh 4 hhhhhh
3 hhhh 4 hhhhhh
3 hhhh 4 IIIIIIII
3 hhhh 4 JJJJJJJ
Then if I select "3" I should get:
hhhh 4 hhhhhh
hhhh 4 hhhhhh
hhhh 4 IIIIIIII
hhhh 4 JJJJJJJ
I got a great code from internet but I just cant "bind" the selected listbox rows to search further for the value I want:
I have this code for every listboxes (I just put 1+ to every name):
Private Sub ListBox4_Click()
Dim Kategorie4 As New Collection
Dim vItem111 As Variant
Dim rFound111 As Range
Dim FirstAddress111 As String
UserForm4.ListBox5.Clear
With Worksheets("Artikel").Range("AK2:A" & (Cells(1000, 1).End(xlUp).Row))
Set rFound111 = .Find(what:=ListBox4.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not rFound111 Is Nothing Then
FirstAddress111 = rFound111.Address
On Error Resume Next
Do
Kategorie4.Add rFound111.Offset(, 1).Value, CStr(rFound111.Offset(, 1).Value)
Set rFound111 = .FindNext(rFound111)
Loop While rFound111.Address <> FirstAddress111
On Error GoTo 0
For Each vItem111 In Kategorie4
Me.ListBox5.AddItem vItem111
Next vItem111
End If
End With
End Sub
my aim is to get a search accordnig to listbox 1 selection and then to listbox 2 selection and then ... so on
I like this, just how to bind the search???
Its about 4000 rows data, trying to get some category
THANK YOU VERY MUCH FOR YOUR HELP
I need urgent help in this case:
1. I have multiple listboxes on a userform.
2. I have a database. 5 Different columns represnt a Category, like:
aaaaa 1 gggg 3 hhhhhh
aaaaa 1 gggg 3 hhhhhh
aaaaa 2 gggg 3 hhhhhh
aaaaa 2 hhhh 3 hhhhhh
aaaaa 3 hhhh 4 hhhhhh
aaaaa 3 hhhh 4 hhhhhh
aaaaa 3 hhhh 4 IIIIIIII
aaaaa 3 hhhh 4 JJJJJJJ
so if I select in 1.st listbox "aaaaa" then after checking how many represnt "aaaaa" I should get:
1 gggg 3 hhhhhh
1 gggg 3 hhhhhh
2 gggg 3 hhhhhh
2 hhhh 3 hhhhhh
3 hhhh 4 hhhhhh
3 hhhh 4 hhhhhh
3 hhhh 4 IIIIIIII
3 hhhh 4 JJJJJJJ
Then if I select "3" I should get:
hhhh 4 hhhhhh
hhhh 4 hhhhhh
hhhh 4 IIIIIIII
hhhh 4 JJJJJJJ
I got a great code from internet but I just cant "bind" the selected listbox rows to search further for the value I want:
I have this code for every listboxes (I just put 1+ to every name):
Private Sub ListBox4_Click()
Dim Kategorie4 As New Collection
Dim vItem111 As Variant
Dim rFound111 As Range
Dim FirstAddress111 As String
UserForm4.ListBox5.Clear
With Worksheets("Artikel").Range("AK2:A" & (Cells(1000, 1).End(xlUp).Row))
Set rFound111 = .Find(what:=ListBox4.Value, LookIn:=xlValues, lookat:=xlWhole)
If Not rFound111 Is Nothing Then
FirstAddress111 = rFound111.Address
On Error Resume Next
Do
Kategorie4.Add rFound111.Offset(, 1).Value, CStr(rFound111.Offset(, 1).Value)
Set rFound111 = .FindNext(rFound111)
Loop While rFound111.Address <> FirstAddress111
On Error GoTo 0
For Each vItem111 In Kategorie4
Me.ListBox5.AddItem vItem111
Next vItem111
End If
End With
End Sub
my aim is to get a search accordnig to listbox 1 selection and then to listbox 2 selection and then ... so on
I like this, just how to bind the search???
Its about 4000 rows data, trying to get some category
THANK YOU VERY MUCH FOR YOUR HELP