insert row (formatting ?)

dawnfoss

Board Regular
Joined
Apr 22, 2002
Messages
100
Is there an easy way to insert rows into a spreadsheet at set intervals? Ie , i need to add a row after every 11th line on an 800 line spreadsheet. The convential way of clicking on the row and then inserting a row is a bit much because of the size of the sheet.
Thanks!
DAwn F
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
You code run a simple macro, like below:

Code:
Sub MyInsertRows()

    Range("A1").Select
    For i = 1 To 73
        ActiveCell.Offset(11, 0).Select
        Selection.EntireRow.Insert
        ActiveCell.Offset(1, 0).Select
    Next i
    
End Sub

I am looping through 73 times because 800 / 11 =72.7.

Hope this helps.
 
Upvote 0
Too slow I know, but as I've written it I might as well post it :).
<pre>Sub RowInsertTest()
Dim rw As Long, i As Integer

rw = Worksheets("Sheet1").Range("A65536").End(xlUp).Row
'the last used row in column A
i = 11
'the number of rows between inserts

Application.ScreenUpdating = False
Do Until rw <= 1
If rw Mod i = 0 Then
Rows(rw).Offset(1, 0).Insert
rw = rw - 1
Else: rw = rw - 1
End If
Loop
Application.ScreenUpdating = True

End Sub</pre>
 
Upvote 0

Forum statistics

Threads
1,214,560
Messages
6,120,222
Members
448,951
Latest member
jennlynn

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