unique text additem combobox

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top