E
eazyc10
I need some help with an Excel Macro.
I have data set that looks as follows:
| ITEM | DATE | QTY |
1234 6/11 10
1235 6/12 5
ETC.
What I want to be able to do is insert X number of rows based on the
quantity field but have the item and date copy to the new rows.
So for example I would have 10 rows of item 1234 6/11 10 and 5 rows
of 1235 6/12 5
I have the code that inserts the blank rows but do not know how to
copy the existing cells to the new rows:
Dim lastRow As Long, cell As Range
Dim i As Long
lastRow = Cells(Rows.Count, "H").End(xlUp).Row + 1
For i = lastRow To 2 Step -1
Set cell = Cells(i, "H")
If IsNumeric(cell(0, 1).Value) Then
If cell(0, 1).Value >= 1 Then
cell.Resize(cell(0, 1).Value) _
.EntireRow.Insert
End If
End If
Next i
I have data set that looks as follows:
| ITEM | DATE | QTY |
1234 6/11 10
1235 6/12 5
ETC.
What I want to be able to do is insert X number of rows based on the
quantity field but have the item and date copy to the new rows.
So for example I would have 10 rows of item 1234 6/11 10 and 5 rows
of 1235 6/12 5
I have the code that inserts the blank rows but do not know how to
copy the existing cells to the new rows:
Dim lastRow As Long, cell As Range
Dim i As Long
lastRow = Cells(Rows.Count, "H").End(xlUp).Row + 1
For i = lastRow To 2 Step -1
Set cell = Cells(i, "H")
If IsNumeric(cell(0, 1).Value) Then
If cell(0, 1).Value >= 1 Then
cell.Resize(cell(0, 1).Value) _
.EntireRow.Insert
End If
End If
Next i