Hi Team,
I am using below code for extracting Unique list and making their Sum.
it works got this solution in this forum only.
Now my task is in Column H Contains list of player Name
and I want make sum of these players sixes in Column I from Column B.
Looking solution in dictionary/Collection. Just for learning purpose. Thanks.
Thanks in advance !
Regards,
mg
I am using below code for extracting Unique list and making their Sum.
it works got this solution in this forum only.
Now my task is in Column H Contains list of player Name
and I want make sum of these players sixes in Column I from Column B.
Looking solution in dictionary/Collection. Just for learning purpose. Thanks.
Thanks in advance !
VBA Code:
Option Explicit
Sub Dictionary()
Dim Ary As Variant
Dim i As Long
Ary = Range("A2", Range("A" & Rows.Count).End(xlUp).Offset(, 1))
With CreateObject("Scripting.dictionary")
For i = 1 To UBound(Ary)
If Not .exists(Ary(i, 1)) Then
.Add Ary(i, 1), Ary(i, 2)
Else
.Item(Ary(i, 1)) = .Item(Ary(i, 1)) + Ary(i, 2)
End If
Next i
Range("D2").Resize(.Count, 2).Value = Application.Transpose(Array(.Keys, .items))
End With
Regards,
mg