eldridge.michael
New Member
I have the following code. It's purpose is to allow users to insert any number of rows that they wish using an input box. However, when you insert, "2", the macro does nothing. Just wondering what simple bit of code I'm overlooking to make this work. It's blowing my mind right now that 1, 3 and any other number I input work without issue. 2!
[pre]
[/pre]
[pre]
Code:
Sub Add()
Dim RowA As String
RowA = 0
RowN = InputBox("Enter the number of rows you would like to add", "Rows")
If RowN = vbCancel Or RowN = 0 Or RowN = "" Then Exit Sub
Set PrevCell = ActiveCell
Application.ScreenUpdating = False
Do
RowA = RowA + 1
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFormLeftOrAbove
If RowA = RowN Then GoTo Here
Loop
Here:
Range("M2").Select
Selection.AutoFill Destination:=Range("M2:M9999")
Range("N2").Select
Selection.AutoFill Destination:=Range("N2:N9999")
PrevCell.Select
Application.ScreenUpdating = True
End Sub