Dim dic As New Scripting.Dictionary dic.Add "a", "apple" dic.Add "b", "banana" 'For Eachで Dim vntKey As Variant For Each vntKey In dic.Keys Debug.Print vntKey & ":" & dic(vntKey) Next 'または Forで Dim intX As Integer For intX = 0 To dic.Count - 1 Debug.Print dic.Keys(intX) & ":" & dic.Items(intX) Next 'Indexで指定でもいい←これは面白い Debug.Print dic.Keys()(0) & ":" & dic.Items()(0) Debug.Print dic.Keys()(1) & ":" & dic.Items()(1) '最後のkeyとvalue Debug.Print dic.Keys()(dic.Count - 1) & ":" & dic.Items()(dic.Count - 1)
0 件のコメント:
コメントを投稿