ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I insert rows alternately (https://www.excelbanter.com/excel-discussion-misc-queries/217871-how-can-i-insert-rows-alternately.html)

nazir

How can I insert rows alternately
 
IF I HAVE DATA ON EXCEL SHEET AND I WANT TO INSERT BLANK ROWS BETWEEN ALL THE
SELECTED ROWS, HOW CAN I DO IT.

Mike H

How can I insert rows alternately
 
Hi,

Right click your sheet tab, view code and paste the code below in.
make your selection and run the code

Sub Marine()
x = Selection.Rows(1).Row
y = Selection.Rows.Count
For I = y To x + 1 Step -1
Rows(I).Insert
Next I
End Sub


Mike

"nazir" wrote:

IF I HAVE DATA ON EXCEL SHEET AND I WANT TO INSERT BLANK ROWS BETWEEN ALL THE
SELECTED ROWS, HOW CAN I DO IT.


Gord Dibben

How can I insert rows alternately
 
It can be done using VBA but why would you want to do this?

You would not be able to sort, filter or otherwise manipulate the data.

If for appearance only, select the rows and double the height.

But if you need the inserted rows, select a bunch of rows and run this
macro.

Sub InsertALTrows()
'David McRitchie, misc 2001-06-30
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Dim I As Integer
For I = Selection(Selection.Count).Row To Selection(1).Row + 1 Step -1
Rows(I).entirerow.Insert
Next I
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub


Gord Dibben MS Excel MVP


On Mon, 26 Jan 2009 03:07:04 -0800, nazir
wrote:

IF I HAVE DATA ON EXCEL SHEET AND I WANT TO INSERT BLANK ROWS BETWEEN ALL THE
SELECTED ROWS, HOW CAN I DO IT.




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

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