I am converting an inventory from the form:
Item ID |
#Small |
#Medium |
#Large... |
1 |
4 |
5 |
6 |
2 |
8 |
9 |
10 |
to
Item ID/SIZE |
#Available |
1Small |
4 |
1Medium |
5 |
1Large |
6 |
2Small |
8 |
... |
|
I have code that does this effectively.
Dim sizes As Integer
sizes = WorksheetFunction.CountA(Range("1:1")) - 1
Do While ActiveCell.Value <> ""
For i = 1 To sizes
ActiveCell.Offset(1, 0).EntireRow.Insert
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = ActiveCell.Offset(-i, 0).Value & Cells(1, i + 1).Value
ActiveCell.Offset(0, 1).Value = ActiveCell.Offset(-i, i).Value
Next i
ActiveCell.Offset(-sizes, 0).EntireRow.Delete
Loop
However, if there are blanks in the table, my current code creates items with 0 available. I would like it to skip blanks and only create a new item if there is a non-zero quantity of that size for that item.
Bookmarks