top of page

vba code to add X rows for each selected row

I devised the below vba code, (a modified version of the code posted here: https://trumpexcel.com/insert-blank-row-after-every-row/ ) to automatically enter X number of rows after each selected row on a worksheet.







Change the number at the end of

EntireRow.Resize(6).

to set the number of rows you want to insert, then increase the number after:

ActiveCell.Offset(7, 0)


by one more number than the number of rows you want to add.









Sub InsertAlternateRows()

'This code will insert a row after every row in the selection

'This code has been created by Sumit Bansal from trumpexcel.com

Dim rng As Range

Dim CountRow As Integer

Dim i As Integer

Set rng = Selection

CountRow = rng.EntireRow.Count


For i = 1 To CountRow

ActiveCell.Offset(1, 0).EntireRow.Resize(6).Insert

ActiveCell.Offset(7, 0).Select

Next i


End Sub











Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page