How to insert blank row after every nth row?

genetist

Board Regular
Joined
Mar 29, 2013
Messages
75
Office Version
  1. 2016
Platform
  1. Windows
Hi to all,
I want to insert a blank row after every nth row for example after every 10th row. I s there any trick for this or we have to use macros? to insert rows automatically?

Thanks,
Regards,
Genetist
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
This is what I did a few mins ago for inserting a row after every 8th, not 10th row, should work if you modify the code.

Code:
Sub SecRev()
    Dim insert_loop As Integer
    For insert_loop = 0 To 100
        Rows(9 + insert_loop * 9).EntireRow.Insert
        Cells(9 + insert_loop * 9, 1).Value = "SecRev"
        Cells(9 + insert_loop * 9, 2).Value = Cells(6 + insert_loop * 9, 2)
        Cells(9 + insert_loop * 9, 3).Value = Cells(6 + insert_loop * 9, 3)
    Next insert_loop
End Sub

Basically you have to create a 9th row, and then it gets shifted down, so instead of 17th row you need to insert 18th row, then instead of 25th row you need to insert 17th row, so on. So instead of * 8 you * 9.
 
Upvote 0
hello,

This code seems to be working for me. I've never worked with VBA, so I'm excited to learn. However, I need to exclude title row, and start from row 2. I dont know how to modify the code to do it. Can you please help?
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,255
Members
448,556
Latest member
peterhess2002

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top