ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   inserting multiple rows in one shot? (https://www.excelbanter.com/excel-discussion-misc-queries/96556-inserting-multiple-rows-one-shot.html)

Greg

inserting multiple rows in one shot?
 
Is it possible to insert a row in every other line all at ounce in an excel
document?
In otherwords I have an Excel document that I have to insert a new row at
every other line and would like a way to do it all in one shot instead of
manually right-clicking each line and inserting a row.

If possible how can this be done

Thanks in advance.
Greg

Chip Pearson

inserting multiple rows in one shot?
 
You can do it with a VBA macro. Select the cells in which you
want to insert the blank lines and run the following code:

Sub AAA()
Dim Ndx As Long
For Ndx = Selection.Cells(1, 1).Row + 1 To _
Selection.Cells(1, 1).Row + (Selection.Rows.Count *
2) Step 2
Rows(Ndx).Insert
Next Ndx
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Greg" wrote in message
...
Is it possible to insert a row in every other line all at ounce
in an excel
document?
In otherwords I have an Excel document that I have to insert a
new row at
every other line and would like a way to do it all in one shot
instead of
manually right-clicking each line and inserting a row.

If possible how can this be done

Thanks in advance.
Greg




Don Guillett

inserting multiple rows in one shot?
 
something like

for i=cells(rows.count,"a").end(xlup).row to 2 step -2
rows(i).insert
next i

--
Don Guillett
SalesAid Software

"Greg" wrote in message
...
Is it possible to insert a row in every other line all at ounce in an
excel
document?
In otherwords I have an Excel document that I have to insert a new row at
every other line and would like a way to do it all in one shot instead of
manually right-clicking each line and inserting a row.

If possible how can this be done

Thanks in advance.
Greg




Gord Dibben

inserting multiple rows in one shot?
 
If the inserted rows are just for readability/appearance, you can select a whack
of rows and double their height at one go.

Otherwise, go with Chip's code.


Gord Dibben MS Excel MVP

On Wed, 28 Jun 2006 07:04:02 -0700, Greg wrote:

Is it possible to insert a row in every other line all at ounce in an excel
document?
In otherwords I have an Excel document that I have to insert a new row at
every other line and would like a way to do it all in one shot instead of
manually right-clicking each line and inserting a row.

If possible how can this be done

Thanks in advance.
Greg




All times are GMT +1. The time now is 10:21 PM.

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