Excel VBA求助,如何把字典转换成数组存出来
发布网友
发布时间:2022-05-02 12:06
我来回答
共4个回答
热心网友
时间:2022-06-20 00:19
将 字典d 放到 A:B 列:
[a1].Resize(d.Count) = Application.Transpose(d.keys)
[b1].Resize(d.Count) = Application.Transpose(d.items)
d.keys 是一个数组, d.items是一个数组
transpose 数组 转置
转置 后放在A:B 两列 即可
热心网友
时间:2022-06-20 00:19
直接赋值就行啊
arr = d.keys
热心网友
时间:2022-06-20 00:20
Sub zhuanhuan()
Dim dic As New Dictionary
Dim Arr(), Brr()
dic.Add "Key1", "Item1"
dic.Add "Key2", "Item2"
dic.Add "Key3", "Item3"
Arr = dic.Keys
Brr = dic.Items
Debug.Print Arr(1), Brr(1)
dic.RemoveAll
Erase Arr, Brr
End Sub
热心网友
时间:2022-06-20 00:20
x=dic.keys '或者x=dic.items
debug.print join(x,vbcrlf)