Inserting a Row Every "X" Rows

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Does anyone know how you might go about inserting a extra row inbetween rows at certain intervals. For instance, auto insert of rows every 3rd row, etc.
 
One way

Sub test()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim R As Long
Dim rng As Range
numRows = 3
Set rng = ActiveSheet.UsedRange
For R = rng.Rows.Count To 1 Step -1
rng.Rows(R + 1).Resize(numRows).EntireRow.insert
Next R
Application.ScreenUpdating = True
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


JMS said:
Does anyone know how you might go about inserting a extra row inbetween rows at certain intervals. For instance, auto insert of
rows every 3rd row, etc.
 
I misunderstood

Try this

Sub test2()
Application.ScreenUpdating = False
Dim numRows As Integer
Dim R As Long
numRows = 1
For R = 300 To 1 Step -3
ActiveSheet.Rows(R + 1).Resize(numRows).EntireRow.insert
Next R
Application.ScreenUpdating = True
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top