Option Explicit
Sub InsertRowAllSheets()
' Thanks to firefytr for the code that has been adapted into this routine
Dim cs As String
cs = ActiveSheet.Name
Dim y As Integer
y = Application.InputBox("Enter the row number you wish to add", _
Type:=1) 'enter 16 to insert a new row 16, the old row _
will become 17 And all other rows push down 1 row As well.
If MsgBox("Are you sure you wish to insert at row " & y & " for ALL sheets?", _
vbYesNo, "Insert row on ALL Sheets") = vbNo Then Exit Sub
Application.ScreenUpdating = False
Dim r As Range
Dim ws As Worksheet
' On Error Resume Next 'Error handler
For Each ws In ThisWorkbook.Worksheets
ws.Activate
Set r = ActiveSheet.Range("A" & y)
If y < 7 Then Goto circumv 'Not to insert in Headers
Range("A" & y).EntireRow.Insert
' code can be inserted here to copy formulas for some or all sheets in the workbook
circumv:
Next ws
Sheets(cs).Activate
Application.ScreenUpdating = True
End Sub
|