I want to have a dictionary where the key will be a string providerName and the value will be a collection of categoryId's. However, this is the result I am getting:
It looks like the key is just item1, item2, item3 etc and the value is just the providerName, and the collection of categoryIds is not there at all.
My code:
For i = 2 To Selection.Rows.Count
providerName = SingleLine(i, 1)
categoryId = SingleLine(i, 3)
Dim categoryIdCollection As New Collection
If Not providerNamesDictionary.exists(providerName) Then
categoryIdCollection.add (categoryId)
providerNamesDictionary.add key:=providerName, Item:=categoryIdCollection
Else
Dim tempCategoryIdCollection As Collection
Set tempCategoryIdCollection = providerNamesDictionary(providerName)
tempCategoryIdCollection.add (categoryId)
Set providerNamesDictionary(providerName) = tempCategoryIdCollection
End If
How do I get the key to be the providerName and the value to be a collection of categoryIds?
