投稿日 | : 2006/11/28(Tue) 15:08 |
投稿者 | : LESIA |
Eメール | : |
URL | : |
タイトル | : Re^3: Collection型について |
Collectionではなく、Dictionaryをつかってはどうでしょうか?
Option Explicit
Private dic As Object
Private Sub Form_Load()
Set dic = CreateObject("Scripting.Dictionary")
dic.Add Key:=1, Item:=1
dic.Add Key:=2, Item:=3
dic.Add Key:=3, Item:=5
End Sub
Private Sub Command1_Click()
Dim obj As Variant
For Each obj In dic
MsgBox CStr(obj)
Next
End Sub
Private Sub Command2_Click()
Dim i As Long
For i = 1 To dic.Count
MsgBox dic.Item(i)
dic.Item(i) = dic.Item(i) + 1
MsgBox dic.Item(i)
Next i
End Sub