Hi All
i have created a userform that contains a list box. This list box builds a UNIQUE list of values from a column- it does so by looping though each row in the column and if it finds a new value it adds it to the list. However, how can I get this list box sorted alphabetically?
My code is as follows thus far:
ListBox1.Clear
Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection
On Error Resume Next
For Each Cell In Range("size")
NoDupes.Add Cell.Value, CStr(Cell.Value)
Next Cell
On Error GoTo 0
For Each Item In NoDupes
ListBox1.AddItem Item
Next Item
Thanks for any help in advance,
i have created a userform that contains a list box. This list box builds a UNIQUE list of values from a column- it does so by looping though each row in the column and if it finds a new value it adds it to the list. However, how can I get this list box sorted alphabetically?
My code is as follows thus far:
ListBox1.Clear
Dim AllCells As Range, Cell As Range
Dim NoDupes As New Collection
On Error Resume Next
For Each Cell In Range("size")
NoDupes.Add Cell.Value, CStr(Cell.Value)
Next Cell
On Error GoTo 0
For Each Item In NoDupes
ListBox1.AddItem Item
Next Item
Thanks for any help in advance,