sunilmulay
10-06-2008, 03:18 AM
I'm a complete VBA newbie.
I've got a worksheet where I want to create an "insert row" macro which copies rows 101:106 and pastes it above the active cell that the user selects. Using the below code, the macro pastes the rows below row 106, and not at the row the user selects....
What's the best way to fix this?
Sub InsertRowPlanning()
'
' InsertRowPlanning Macro
'
ActiveSheet.Unprotect Password:=PWORD
Rows("101:106").Select
Selection.Copy
ActiveCell.Select
Selection.Insert Shift:=xlDown
ActiveCell.EntireRow.Select
Application.CutCopyMode = False
ActiveSheet.Protect Password:=PWORD
End Sub
Thanks in advance!
Sunil
I've got a worksheet where I want to create an "insert row" macro which copies rows 101:106 and pastes it above the active cell that the user selects. Using the below code, the macro pastes the rows below row 106, and not at the row the user selects....
What's the best way to fix this?
Sub InsertRowPlanning()
'
' InsertRowPlanning Macro
'
ActiveSheet.Unprotect Password:=PWORD
Rows("101:106").Select
Selection.Copy
ActiveCell.Select
Selection.Insert Shift:=xlDown
ActiveCell.EntireRow.Select
Application.CutCopyMode = False
ActiveSheet.Protect Password:=PWORD
End Sub
Thanks in advance!
Sunil