Dictionaryオブジェクト(連想配列)をセルに代入する際、
Rangeを使い一気に代入することはできますか。
Cells(i, 1) = data1
Cells(i, 2) = Dic.Item(data1)
の部分の代入を一回でできればと思っています。
よろしくお願いします。
Excel
1Sub test2() 2 Dim Dic As Object 3 Set Dic = CreateObject("Scripting.Dictionary") 4 Dic.Add "A001", "ぶどう" 5 Dic.Add "A002", "レモン" 6 Dic.Add "A003", "みかん" 7 8 Dim data1 As Variant 9 Dim i As Long 10 i = 1 11 For Each data1 In Dic 12 Cells(i, 1) = data1 13 Cells(i, 2) = Dic.Item(data1) 14 i = i + 1 15 Next 16End Sub

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2022/04/26 10:46