LoginSignup
1
2

More than 5 years have passed since last update.

VBA_Dictionaryの書き換え

Posted at

1.概要

Dictionaryでデータ書き換えの際ハマった

2.ソースコード


'Dictionaryでハマったら追記
Sub Dictionary備忘録()
    Dim dic As New Dictionary
    Call dic.Add("a", 1)

    'Keys、Itemsで値の更新は出来ない
    dic.Keys(0) = "b"
    dic.Items(0) = 2
    Debug.Print dic.Keys(0) & ":" & dic.Items(0)

    'Key、Itemは値の更新可能
    dic.key("a") = "b"
    dic.Item("b") = 2
    Debug.Print dic.Keys(0) & ":" & dic.Items(0)

3.実行結果

a:1
b:2

1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2