Hello,
I have a Combobox which is indirectly controlling the values of a ListBox. Unfortunately the ListBox contains all possible entries. Many of them exist multiple times and they are not sorted.
Is there a possibility to at least get rid of the multiple entries?
If the List could then be organized ascending, it would be perfect
Following comes my code for the ListBox
Cheers
Jan
I have a Combobox which is indirectly controlling the values of a ListBox. Unfortunately the ListBox contains all possible entries. Many of them exist multiple times and they are not sorted.
Is there a possibility to at least get rid of the multiple entries?
If the List could then be organized ascending, it would be perfect
Following comes my code for the ListBox
Cheers
Jan
Code:
Private Sub cboPc_Change()
Dim ljh As String
Set wksData = ThisWorkbook.Sheets("Data")
lstLjh.Clear
For i = 2 To wksData.Cells(65536, 5).End(xlUp).Row
ljh = wksData.Cells(i, 5).Value
If UserForm1.cboPc.Value = ljh Then
lstLjh.AddItem wksData.Cells(i, 2)
End If
Next i
ThisWorkbook.Sheets("Filtering").Cells(2, 5).Value = cboPc.Value
End Sub