Hello Excel Forum,
I'm trying to build a very basic de-duplication tool by using two dictionary objects. Each company on my list (there are two lists - a source and one to check against) has a unique ID, which I intend to use as the key in each dictionary (I haven't included the code for generating both dictionary objects).
The problem I'm having is that my intended key is being stored as a value (when I 'watch' the variable the value shows as the intended key). However, when I switch the order of my code I get 'key already used' errors. In the code below column "B" contains the unique ID and column "E" contains the company name. (SICompanies and SIZips are dimensioned as objects):
Set SICompanies = CreateObject("Scripting.Dictionary")
Set SIZips = CreateObject("Scripting.Dictionary")
For i = 1 To recCountALL
With ws
'add SI companies and zips to collections using IDs on sheet as collection keys
If .Range("B1").Offset(i, 0).Value > 0 Then
SICompanies.Add .Range("B1").Offset(i, 0).Value, .Range("E1").Offset(i, 0).Value
SIZips.Add .Range("B1").Offset(i, 0).Value, .Range("E1").Offset(i, 6).Value
End If
End With
Next i
Any help/advice would be much appreciated.
Thanks
Williams485
Bookmarks