C
CG Rosén
Good Day Group,
When using the below code to "fill" a ComboBox how to ensure that
only unique text will be added. The text that is in Range ("A1:A1000") is of
this type:
001
001
001
002
003
003
004
as a result I would like the combobox listtext to show
001
002
003
004 etc
Brgds
CG Rosén
----------------------------------------------------------------------------------------------
With Worksheets("Sheet").Range("A1:A1000")
Set k = .Find(nr, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)
If Not k Is Nothing Then
firstAddress = k.Address
Do
r = k.Row
Me.ComboBox1.AddItem Mid(Sheets("Sheet1").Cells(r, 1).Text, 1, 3)
Set k = .FindNext(k)
Loop While Not k Is Nothing And k.Address <> firstAddress
End If
End With
When using the below code to "fill" a ComboBox how to ensure that
only unique text will be added. The text that is in Range ("A1:A1000") is of
this type:
001
001
001
002
003
003
004
as a result I would like the combobox listtext to show
001
002
003
004 etc
Brgds
CG Rosén
----------------------------------------------------------------------------------------------
With Worksheets("Sheet").Range("A1:A1000")
Set k = .Find(nr, _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByColumns)
If Not k Is Nothing Then
firstAddress = k.Address
Do
r = k.Row
Me.ComboBox1.AddItem Mid(Sheets("Sheet1").Cells(r, 1).Text, 1, 3)
Set k = .FindNext(k)
Loop While Not k Is Nothing And k.Address <> firstAddress
End If
End With