S
Shoney
Hello,
I'm trying to write a macro that will insert a number of rows based on a
cell's value.
For example, if the value of a cell in column "U", beginning w/ "U2", is 2,
insert one row under it. Then, go to the next integer in column "U" (in this
case, "U4". I would like for the macro to repeat until there is no longer a
value in column "U".
Note: If the value in "U" is 1, then no rows would need to be inserted.
The code that I have so far is as follows:
Sub AddMultitipleRows()
If Range("U2") > 1 Then
'Insert that number of rows
Rows.Insert Shift:=xlDown
End If
Do Until ActiveCell.Value = 0
ActiveCell.Offset(1, 0).Select
Loop
End Sub
I appreciate any help you can provide.
Thank you.
I'm trying to write a macro that will insert a number of rows based on a
cell's value.
For example, if the value of a cell in column "U", beginning w/ "U2", is 2,
insert one row under it. Then, go to the next integer in column "U" (in this
case, "U4". I would like for the macro to repeat until there is no longer a
value in column "U".
Note: If the value in "U" is 1, then no rows would need to be inserted.
The code that I have so far is as follows:
Sub AddMultitipleRows()
If Range("U2") > 1 Then
'Insert that number of rows
Rows.Insert Shift:=xlDown
End If
Do Until ActiveCell.Value = 0
ActiveCell.Offset(1, 0).Select
Loop
End Sub
I appreciate any help you can provide.
Thank you.