Okay so this is driving me nuts as I have searched and searched and found no way possible except a Cpearson example which requires I download an additional add on which is not feasible as I am not having my users install new add ons to use a template.
I have a dictionary of strings, this is the easiest way for me to get a unique list of teams from a column filled with thounsands of rows. And I did not want to create an array of possibly a couple hundred in size.
Now my only problem is I need this dictionary sorted, or to at least print in alphabetical order.
500 point to anyone who can do this, obviously putting the dictionary into an array and then sorting the array is not optimal as I said this could have hundreds of outputs....
'*** Gets unique and sorted list of teams
Dim dic As Object, x, r As Range
Set dic = CreateObject("Scripting.Dictionary")
For Each r In Sheets(SheetName).Range("H3", Sheets(SheetName).Range("H65536").End(xlUp))
If Not IsEmpty(r) Then
If Not dic.exists(r.Value) Then
dic.Add r.Value, Nothing
' How many teams?
'Iterate through the array of items. These items can include objects aswell.
i = 4
For Each strKey In dic.keys()
SheetXXX.Range("E" + CStr(i)).Value = strKey
i = i + 1