Hi Team,
I am comparing two list and bringing Unique values.
I am able to get output of unique keys, But how to get Dictionary Items of that unique key as well. Thanks
I am storing data into Array as my data are different workbooks.
Below attempted code, gives correct unique keys except Items, how to get it.
Below is a Table , expected output I & j Columns
Thanks
mg
I am comparing two list and bringing Unique values.
I am able to get output of unique keys, But how to get Dictionary Items of that unique key as well. Thanks
I am storing data into Array as my data are different workbooks.
Below attempted code, gives correct unique keys except Items, how to get it.
VBA Code:
Sub Dictionary_Find_New_Entry()
ary_Compare = Range("f2:f4").Value2
ary_base = Range("A2:b5").Value2
Dim dict As New Scripting.Dictionary
Dim i As Long
With dict
.CompareMode = TextCompare
For i = LBound(ary_base) To UBound(ary_base)
.Item(ary_base(i, 2)) = "Empty"
If .Item(ary_base(i, 2)) <> "" Then
If Not .Exists(ary_base(i, 2)) Then
.Add (ary_base(i, 2)), (ary_base(i, 1))
End If
End If
Next i
For i = LBound(ary_Compare) To UBound(ary_Compare)
If .Exists(ary_Compare(i, 1)) Then .Remove (ary_Compare(i, 1))
Next i
End With
Range("J1").value = dict.Keys(0) ' Giving correct output :=> Goods damaged in Transit
Range("I1").value dict.Items(0) :=> should give [B]37133[/B]
End Sub
Below is a Table , expected output I & j Columns
Book2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | Invoice no | Comments | Comment | Expected Output | Key-Dictionary | |||||||
2 | 14656 | Goods in Wareshouse | Goods in Wareshouse | 37133 | Goods damaged in Transit | |||||||
3 | 27524 | Goods Returned | goods Returned | |||||||||
4 | 37133 | Goods damaged in Transit | Goods Sold | |||||||||
5 | 23427 | Goods Sold | ||||||||||
Sheet1 |
Thanks
mg