I would like to iterate through a dictionary's keys and put them in cells.
I tried that:
Dim dic1 As Object
Set dic1 = CreateObject("Scripting.Dictionary")
dic1.Add "name1", "value1"
dic1.Add "name2", "value2"
For i = 0 To Len(dic1)
Cells(1, dic1()(i)) = dic1()(i).Key
Next
I added the parentheses to avoid an error but I still get Wrong number of arguments or invalid property assignment
.
To answer a comment, I would like to avoid For Each
.
Edit: following this link, I tried:
Set cell1 As String
cell1 = dic1.Items(1)
It didn't work. I got Property let procedure not defined and property get procedure did not return an object
. Does it mean that it's not a dictionary?