How can I insert a blank row after every four rows in Excel?

G

Guest

I have a large file (1,000+ rows) and I need to insert a blank row after
every four rows. Is there an easy way to do this without having to manually
insert each row?

Thank you.
 
G

Guest

hi,
here is something that might help. paste this code in a standard module and
run it.
Sub Macro1()

Dim r1 As Range
Dim r2 As Range

Range("A6").Select
Set r1 = Range("A6") 'assuming you have a header row
Do While Not IsEmpty(r1)
Set r2 = r1.Offset(4, 0)
ActiveCell.EntireRow.Insert
r1.Offset(4, 0).Select
Set r1 = r2
Loop

End Sub

regards
FSt1
 
G

Guest

Hi,

Try this with using a helper column:

in the first row of your data in helper column enter 1 and in the second row
enter 2 and then highlight the numbers 1 & 2 copy drag to last row of your
data you see a number in the last row of your data in helper column e.g:
1300, then enter 5 inthe row after that number and 9 in the next row
highlight 5 & 9 and copy darg down to whenever you see the number 1300
lighlight all yur data with the blank rows with numbers and then sort
highlighted area based on the helper column.

example:

A B C D

1 data data data 1
2 data data data 2
3 data data data 3
.. data data data .
.. data data data .
1300 data data data 1300
1301 BLANK ROWS 5
1302 BLANK ROWS 9
1303 BLANK ROWS 13
.. BLANK ROWS .
.. 1300

you can highlight all tese datas and blank rows and the sort it based on
column D

it should work.

Thanks,
 

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

Top