I have cells values like image below
I need to transform with VBA code like image below
SUM QTY on col3 based on code from col1 where I have same value.
Thank you.
Dim LastRow1 As Long
With ActiveSheet
LastRow1 = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Dim cc As Integer
For cc = 2 To LastRow1
If Cells(cc, 1).Value = Cells(cc - 1, 1).Value Then
Range("C:C").NumberFormat = "0"
Rows(cc + 1).Insert Shift:=xlShiftDown
Range("C" & cc + 1).Value = "=Sum(C" & cc & ", C" & cc - 1 & ")"
Cells(cc + 1, 3).Value = Cells(cc + 1, 3).Value
Cells(cc, 1).Select
Selection.Copy
Cells(cc + 1, 1).PasteSpecial Paste:=xlPasteValues
Cells(cc, 2).Select
Selection.Copy
Cells(cc + 1, 2).PasteSpecial Paste:=xlPasteValues
Cells(cc, 4).Select
Selection.Copy
Cells(cc + 1, 4).PasteSpecial Paste:=xlPasteValues
Rows(cc).EntireRow.Delete
Rows(cc - 1).EntireRow.Delete
End If
Next cc

