I have recently come across the dictionary object in Excel VBA. The code below (same in the workbook) does a fine job of going through a list of names ignoring all duplicates.
I know that the dictionary contains the information, but I don't know how to extract the contents of the dictionary. I would like the transfer the contents of the dictionary to a string array.
The excel workbook included has one "button" with the following code.
Private Sub CommandButton2_Click()
Dim NameList() As Variant
Dim dict As Object, c As Variant, i As Long, lr As Long
Set dict = CreateObject("Scripting.Dictionary")
lr = Cells(Rows.Count, 1).End(xlUp).Row
c = Range("a1:a45" & lr)
For i = 1 To UBound(c, 1)
dict(c(i, 1)) = 1