Hi Team,
I am unable to print dictionary items , Attached are two examples.
This works:-
This is not working.
Expected output Range D2
Thanks
mg
I am unable to print dictionary items , Attached are two examples.
This works:-
VBA Code:
Sub Dictionary_Excercise_1()
Dim dic1 As New Scripting.dictionary
dic1.Add "MrExcel", 10000
Range("A2").Resize(dic1.Count, 2).Value = Application.Transpose(Array(dic1.keys, dic1.items))
End Sub
This is not working.
VBA Code:
Sub Dictionary_Excercise_2()
Dim dic2 As New Scripting.dictionary
dic1.Add "MrExcel", [B]Array(10000, 20000, 30000)[/B]
Range("D2").Resize(dic2.Count, [B]3[/B]).Value = Application.Transpose(Array(dic2.keys, dic2.items)) 'getting error type mismatch.
End Sub
Expected output Range D2
Book1 | |||||||||
---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | |||
1 | Dictionary Example - 1 | Dictionary Example - 2 | |||||||
2 | MrExcel | 10000 | MrExcel | 10000 | 20000 | 30000 | |||
Sheet2 |
Thanks
mg