Adam
Here's a couple of ways, one using a collection, and the other using a dictionary.
Run each of the codes, and view the output. They both use a space as a word separator. The dictionary will see the and The as 2 different words, while the collection treats them the same.
Sub aaa()
Set nodupes = New Collection
For i = 1 To 12
arr = Split(Cells(i, 1), " ")
For j = LBound(arr) To UBound(arr)
On Error Resume Next
nodupes.Add Item:=arr(j), key:=arr(j)
On Error GoTo 0
Next j
Next i
Range("G:I").ClearContents
For i = 1 To nodupes.Count
Cells(i, "G") = nodupes(i)
Next i
Range("G:G").Sort key1:=Range("G1"), order1:=xlAscending, header:=xlNo
End Sub
Sub bbb()
Set dic = CreateObject("scripting.dictionary")
For i = 1 To 12
arr = Split(Cells(i, 1), " ")
For j = LBound(arr) To UBound(arr)
If Not dic.exists(arr(j)) Then
dic.Add Item:=arr(j), key:=arr(j)
End If
Next j
Next i
For Each ce In dic.items
Cells(Rows.Count, 9).End(xlUp).Offset(1, 0).Value = ce
Next ce
Range("I:I").Sort key1:=Range("I1"), order1:=xlAscending, header:=xlNo
End Sub
rylo
Bookmarks