Quantcast
Channel: dictionaryタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 99

VBA_Dictionaryの書き換え

$
0
0

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


Viewing all articles
Browse latest Browse all 99

Trending Articles