VBA有字典结构吗?VBA有字典结构吗?比如键<>值数组?
3 回答
天涯尽头无女友
TA贡献1831条经验 获得超9个赞
Set dict = CreateObject("Scripting.Dictionary")
Dim dict As New Scripting.Dictionary
If Not dict.Exists(key) Then dict.Add key, valueEnd If
Nothing
Set dict = Nothing
至尊宝的传说
TA贡献1789条经验 获得超10个赞
Dim c As Collection Set c = New Collection c.Add "Data1", "Key1" c.Add "Data2", "Key2" c.Add "Data3", "Key3" 'Insert data via key into cell A1 Range("A1").Value = c.Item("Key2")
Collection
Contains()
Public Function Contains(col As Collection, key As Variant) As Boolean On Error Resume Next col(key) ' Just try it. If it fails, Err.Number will be nonzero. Contains = (Err.Number = 0) Err.ClearEnd Function
长风秋雁
TA贡献1757条经验 获得超7个赞
Dim dSet d = CreateObject("Scripting.Dictionary")d.Add "a", "aaa"d.Add "b", "bbb"d.Add "c", "ccc"If d.Exists("c") Then MsgBox d("c")End If
添加回答
举报
0/150
提交
取消