ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Insert Multiple Blank Rows (https://www.excelbanter.com/excel-discussion-misc-queries/183688-insert-multiple-blank-rows.html)

CJ

Insert Multiple Blank Rows
 
How do I insert 2 blank rows after each line of data? I have a very large
spreadsheet that I need to format and upload into an accounting application.
The format requires that two blank rows follow each line.

I used the below macro but, it only inserts one row rather then two.

Sub RowInsert()

For X = 2 To 12000
Rows(X).Select
Selection.Insert Shift:=xlDown
X = X + 1
Next X

End Sub


T Kirtley

Insert Multiple Blank Rows
 
CJ,

Try the following modified code:

Sub RowInsert()

For x = 2 To 12000
Rows(x & ":" & x + 1).Select
Selection.Insert Shift:=xlDown
x = x + 2
Next x

End Sub

Hope that helps,

TK

"CJ" wrote:

How do I insert 2 blank rows after each line of data? I have a very large
spreadsheet that I need to format and upload into an accounting application.
The format requires that two blank rows follow each line.

I used the below macro but, it only inserts one row rather then two.

Sub RowInsert()

For X = 2 To 12000
Rows(X).Select
Selection.Insert Shift:=xlDown
X = X + 1
Next X

End Sub


CJ

Insert Multiple Blank Rows
 
Thank you so much, TK. It worked perfectly.

"T Kirtley" wrote:

CJ,

Try the following modified code:

Sub RowInsert()

For x = 2 To 12000
Rows(x & ":" & x + 1).Select
Selection.Insert Shift:=xlDown
x = x + 2
Next x

End Sub

Hope that helps,

TK

"CJ" wrote:

How do I insert 2 blank rows after each line of data? I have a very large
spreadsheet that I need to format and upload into an accounting application.
The format requires that two blank rows follow each line.

I used the below macro but, it only inserts one row rather then two.

Sub RowInsert()

For X = 2 To 12000
Rows(X).Select
Selection.Insert Shift:=xlDown
X = X + 1
Next X

End Sub


Gord Dibben

Insert Multiple Blank Rows
 
See a reply at your other post.

Not necessary to use a fixed number of rows...12000.......and those "selects"
just slow down your code.


Gord Dibben MS Excel MVP

On Mon, 14 Apr 2008 12:43:00 -0700, CJ wrote:

Thank you so much, TK. It worked perfectly.

"T Kirtley" wrote:

CJ,

Try the following modified code:

Sub RowInsert()

For x = 2 To 12000
Rows(x & ":" & x + 1).Select
Selection.Insert Shift:=xlDown
x = x + 2
Next x

End Sub

Hope that helps,

TK

"CJ" wrote:

How do I insert 2 blank rows after each line of data? I have a very large
spreadsheet that I need to format and upload into an accounting application.
The format requires that two blank rows follow each line.

I used the below macro but, it only inserts one row rather then two.

Sub RowInsert()

For X = 2 To 12000
Rows(X).Select
Selection.Insert Shift:=xlDown
X = X + 1
Next X

End Sub




All times are GMT +1. The time now is 04:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com