redspanna
Well-known Member
- Joined
- Jul 27, 2005
- Messages
- 1,604
- Office Version
- 365
- Platform
- Windows
this code below I have found on a previous post by another member but it doesn't quite do what I want
instead of inserting the number of rows given by the msgbox input at the first empty row, I want it inserted at the firat empty row ofsett by -7 rows.
so if last empty row in column B is row 107 I want xx rows inserted at row 100
any help appreciated
Code:
Sub InsertRows()
Dim lngRows As Long, lngNextRow As Long
On Error GoTo Finish
lngRows = CLng(InputBox("How many rows do you wish to insert?"))
lngNextRow = Range("B" & Rows.Count).End(xlUp).Row + 1
Rows(3).Copy Rows(lngNextRow & ":" & lngNextRow + lngRows - 1)
Finish:
If Err.Number <> 0 Then MsgBox Prompt:="Please ensure you only enter numeric values!"
End Sub
instead of inserting the number of rows given by the msgbox input at the first empty row, I want it inserted at the firat empty row ofsett by -7 rows.
so if last empty row in column B is row 107 I want xx rows inserted at row 100
any help appreciated