I'm trying to make a collection out of a list of items in cells. Each cell may or may not have a few items separated by ","'s...
I've got that part down...At least I think... but then I get to line 9, my DontDupe collection is empty... I expected it to possibly just hold the last added collection .... but it has nothing...not sure whats I'm missing, but everything seems to be fine up to that point.
Please find the code I am using below.
thank you in advance!
here is my splitting function
I've got that part down...At least I think... but then I get to line 9, my DontDupe collection is empty... I expected it to possibly just hold the last added collection .... but it has nothing...not sure whats I'm missing, but everything seems to be fine up to that point.
Please find the code I am using below.
thank you in advance!
Code:
Dim DontDupe As New Collection
Dim splitdies As New Collection
1 Set dies = ws.Range("Standards[Die Number]")
On Error Resume Next
2 For Each die In dies
3 drow = die.Row
4 dcol = die.Column
5 Set splitdies = Splitter(ws.Cells(drow, dcol))
6 For Each guy In splitdies
7 DontDupe.Add guy.Value, CStr(guy.Value)
8 Next guy
9 Next die
''I will then get rid of any duplicates and put this collection into a combo box...
'-----------------------------------------------------------------------------
here is my splitting function
Code:
Function Splitter(rg As Range) As Collection
Dim x As New Collection
Dim hey As Variant
hey = Split(rg.Value, ",")
For j = 0 To UBound(hey, 1)
x.Add hey(j), CStr(hey(j))
Next
Set Splitter = x
End Function