vba dictionnary code example
Example: vba dictionnary
Dim myDict As New Scripting.Dictionary
Dim key As Variant
With myDict
.Add key:="Sarah", Item:=50
.Add "John", 10
Debug.Print .Item("Sarah") ' 50
If .Exists("John") Then
Debug.Print .Item("John") ' 10
End If
For Each key In .Keys
Debug.Print key, .Item(key) ' Sarah 50 John 10
Next key
.Remove ("John")
End With