Hi all,
I found the following code when searching for a way to insert multiple rows based on a given cell's value. Can someone please help me understand what the code says?
Sub Insert_Row ()
Lastrow = Worksheets(“Sheet1”).Cells(Rows.Count, 1).End(xlUp).Row
For i= Lastrow To 2 Step by -1
a = Worksheets(“Sheet1”).Cells(I,3).Value
for j-1 to a
Worksheets(“Sheet1”).Row)(i).Select
Selection.Insert Shift:=xlDown
Next
Next
Worksheets(“Sheet1”).Cells(1,1).Select
End Sub
I found the following code when searching for a way to insert multiple rows based on a given cell's value. Can someone please help me understand what the code says?
Sub Insert_Row ()
Lastrow = Worksheets(“Sheet1”).Cells(Rows.Count, 1).End(xlUp).Row
For i= Lastrow To 2 Step by -1
a = Worksheets(“Sheet1”).Cells(I,3).Value
for j-1 to a
Worksheets(“Sheet1”).Row)(i).Select
Selection.Insert Shift:=xlDown
Next
Next
Worksheets(“Sheet1”).Cells(1,1).Select
End Sub