Insert Multiple Rows Using Excel Macros
If you need to insert multiple rows using Macros in Excel then you can do this easily with the help of Macros. Enable your Developer Tab of excel before doing this.
Purpose of this tutorial: you will learn to using macros for inserting multiple rows.
Before following the procedure of this tutorial make sure you have enabled the Excel’s Developer Tab.
STEP 1: GO TO DEVELOPER> CODE> VISUAL BASIC> COPY/PASTE THE CODE BELOW > CLOSE THE WINDOW
Copy The Code Below;
Sub InsertMultipleRows()
Dim numRows As Integer
Dim counter As Integer‘Select the current row
ActiveCell.EntireRow.Select
On Error GoTo Last
numRows = InputBox(“Enter number of rows to insert“, “Insert Rows”)‘Keep on inserting rows until we reach the desired number
For counter = 1 To numRows
Selection.Insert Shift:=xlToDown, CopyOrigin:=xlFormatFromRightorAbove
Next counter
Last:Exit Sub
End Sub
STEP2. Test it by selecting any cell in which you need to insert rows on then follow
Go to Developer > Code > Macros > Run
By using Macros within three steps now you can insert multiple rows.
Leave a Reply