我有大字典键,我想将其插入到 excel 表的列中。我通过以下方式完成了:
Dim a, d, i 'Create some variables
Set d = CreateObject("Scripting.Dictionary")
d.Add "a", "Athens" 'Add some keys and items.
d.Add "b", "Belgrade"
d.Add "c", "Cairo"
a = d.keys 'Get the keys
For i = 0 To d.Count - 1 'Iterate the array
ob.Cells(i + 1, 1).Value = a(i)
Next
但它可以在一个声明中完成吗?说obj2.Cells(1,1).Resize(dicP.Count,1)=a
我也试过这个,但它只把第一个键放在我定义的范围内Resize
。