1. Part 1- Basics of Dictionary
a) Dictionary is used to assign a value to a key/item
b)Syntax
i) If I want to create Gowtham as new dictionary
Dim Gowtham as Newdictionary
ii) Add items to the dictionary Gowtham
For Eg. I want to assign 1 to a, 2 to b
gowtham. add(a,1)
gowtham. add(a,2)
c) When a key is not already declared and is called later, it will get created in dictionary
For Eg,
Sub usedictionary()
Dim dict As New Dictionary
dict.Add "a", 1
dict.Add "b", 2
dict.Add "c", 3
dict("d") = dict("d") + 100
Debug.Print dict("d")
End Sub
..., the above code will print 100
No comments:
Post a Comment