Private Sub ComboBox1_Change()
i = 0
Me.ListBox2.Clear
For Each c In Range([A2], [A65000].End(xlUp))
If c.Offset(0, 0) = Me.ComboBox1 Or Me.ComboBox1 = "*" Then
Me.ListBox2.AddItem
Me.ListBox2.List(i, 0) = c.Value
Me.ListBox2.List(i, 1) = c.Offset(0, 1).Value
Me.ListBox2.List(i, 2) = c.Offset(0, 2).Value
Me.ListBox2.List(i, 3) = c.Offset(0, 3).Value
i = i + 1
End If
Next c
End Sub
Private Sub ListBox2_Click()
i = 0
Me.ListBox1.Clear
For Each c In Range([A2], [A65000].End(xlUp))
If c.Offset(0, 0) = Me.ListBox2 Then
Me.ListBox1.AddItem
Me.ListBox1.List(i, 0) = c.Value
Me.ListBox1.List(i, 1) = c.Offset(0, 1).Value
Me.ListBox1.List(i, 2) = c.Offset(0, 2).Value
Me.ListBox1.List(i, 3) = c.Offset(0, 3).Value
i = i + 1
End If
Next c
End Sub
Private Sub UserForm_Initialize()
Set mondico = CreateObject("Scripting.Dictionary")
For Each c In Range("a2:a15")
If Not mondico.Exists(c.Value) Then mondico.Add c.Value, c.Value
Next c
Me.ComboBox1.AddItem "*"
For Each i In mondico.items
Me.ComboBox1.AddItem i
Next
End Sub