KP_SoCal
Board Regular
- Joined
- Nov 17, 2009
- Messages
- 116
I’m using Excel 2007, and I would like to trigger the sub routine listed below when a user attempts to insert a row(s). I’m guessing it would have to be fired on a “Worksheet Change” event. So the logic might go something like, after rows are inserted then Application.Undo (this would undo the rows that were just manually inserted by using the Insert Command on the Ribbon or from right-clicking with the mouse and the cursor would return to where the end user attempted to manually insert the rows) and then the following sub routine would fire…<o></o>
<o> </o>
Sub InsertRow()
Dim Rng, n As Long
Application.ScreenUpdating = False
Rng = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 0)).Select
Selection.EntireRow.Insert
End Sub<o></o>
<o> </o>
Thanks in advanced for any suggestions! <o></o>
<o> </o>
Sub InsertRow()
Dim Rng, n As Long
Application.ScreenUpdating = False
Rng = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 0)).Select
Selection.EntireRow.Insert
End Sub<o></o>
<o> </o>
Thanks in advanced for any suggestions! <o></o>