Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
Hello,
I am using the code below to take the values in column G (starting at G6) of worksheet "LISTS1" to create the rowsource for combobox "cb_league1" in my userform.
It works, but I would like to enhance it (if possible) to use only unique values in the rowsource. With the code I get now, I am getting multiple instances of the same value, which is unnecessary.
I am using the code below to take the values in column G (starting at G6) of worksheet "LISTS1" to create the rowsource for combobox "cb_league1" in my userform.
Code:
With Worksheets("LISTS1")
Set Rng = .Range("G6", .Range("G6").End(xlDown))
End With
For Each cell In Rng.Cells
With Me.cb_league1
.AddItem cell.Value
.List(.ListCount - 1, 1) = cell.Offset(0, 1).Value
.List(.ListCount - 1, 2) = cell.Offset(0, 2).Value
End With
Next cell
It works, but I would like to enhance it (if possible) to use only unique values in the rowsource. With the code I get now, I am getting multiple instances of the same value, which is unnecessary.