peispud
asked on
Extracting data from scripting dictionary
Hi
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.
Thank you.
The excel workbook included has one "button" with the following code.
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.
Thank you.
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
Next i
End Sub
Accumulated-Time-2.xlsm
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Brains beats brawn.
Thank you very much!!