quantity

0

I entered a list of inventory, but i have multiple duplicates and I will like to combine them. I want them to be combined with the qty listed in the next row.

Answer
Discuss

Discussion

Please post your workbook. You can attach it to your original question by clicking "Edit" for the question and then scroll down to the button that enables you to select an attachment from your computer.
Variatus (rep: 3128) Oct 30, '19 at 10:18 pm
Add to Discussion

Answers

0

You gave insufficient data to write and test this in Excel, so... Copy the list to a blank sheet then select the top item in the list before running this code. Note, this code asssumes that your list is only two columns, you may have to edit it to suit otherwise.

Sub ConsolidateAndDelete()

Dim Cel As Range
Set Cel = Selection

Do While Cel.Offset(1) <> ""
   Do While Cel.Offset(1) = Cel
      Cel.Offset(0, 1) = Cel.Offset(0, 1) + Cel.Offset(1, 1)
      .Offset(1).Resize(0, 2).Delete Shift:=xlShiftUp
   Loop
   Set Cel = Cel.Offset(1)
Loop
End Sub
Discuss


Answer the Question

You must create an account to use the forum. Create an Account or Login