Hello everyone
I have a range in which I need to sum the total and this is the code till now
Sub yyy()
Dim a As Variant
Dim i As Long
Dim k As Variant
Dim c As Long
Dim s As Variant
a = Range("B10:D20").Value
c = 10
Dim dic As Object
Set dic = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(a)
s = a(i, 1)
If s <> "" Then
If Not dic.Exists(s) Then dic(s) = Array(, 0)
dic(s) = Array(a(i, 1), dic(s)(1) + a(i, 3))
End If
Next i
If dic.Count > 4 Then MsgBox "There Are More Than 4 Items. Cancelled", vbExclamation: Exit Sub
For Each k In dic.keys
Cells(8, c).Value = k
''Need to get the total for the item
Cells(8, c + 1).Value = dic.Item(k)
c = c + 2
Next k
End Sub
I just need help at that point ::''Need to get the total for the item
Thanks advanced for help
Bookmarks