Sunday, May 13, 2007

Inserting Rows


To insert rows required by a user is easy. Here the input box is used so that a user can define the number of rows required.

Sub InsertRow()
Dim Rng
Rng = InputBox("Enter number of rows required.")
Range(ActiveCell.Offset(0, 0), ActiveCell.Offset(Rng - 1, 0)).Select
Selection.EntireRow.Insert
End Sub

Here the macro uses the range technique where a range is first selected and then subsequently rows are inserted.

No comments:

Post a Comment