hi
I try merging duplicated items based on COL A and summing the values . so far the code doesn't work . I need help from experts check the code and guide me how correct my mistake . I attached file contains a simple data , but my real data are at least 2000 rows that's why I would do that by vba . I put expected result in COL F,G .
Sub summing_duplicateditems()
Dim R As Long, Data As Variant, Uniques
Data = Range("A2", Cells(Rows.Count, "D").End(xlUp))
With CreateObject("Scripting.Dictionary")
For R = 1 To UBound(Data)
.Item(Data(R, 1)) = Application.Max(.Item(Data(R, 1)), Data(R, 4))
Next
Range("F2:F" & .Count) = Application.Transpose(.Keys)
Range("G2:G" & .Count) = Application.Transpose(.Items)
End With
End Sub
thanks in advance