I have a spreadsheet of incoming products and the shipping containers they are arriving on. I want to combine rows with duplicate items while preserving the quantities of that item in each container column. For this I've been using the following VBA code:
Sub combine()
Dim c As Range
Dim i As Integer
For Each c In Range("A2", Cells(Cells.SpecialCells(xlCellTypeLastCell).Row, 1))
If c = c.Offset(1) And c <> "" Then
For i = 1 To 15
If c.Offset(1, i) <> "" Then
c.Offset(, i) = c.Offset(1, i)
End If
Next
c.Offset(1).EntireRow.Delete
End If
Next
End Sub
This code works great, however, sometimes these items have multiple rows with quantities in the same container. This code merely replaces the quantity above with the quantity below. I need them to be added.
Spreadsheet.png
Bookmarks