Excel help
 

MegaSack DRAW - This year's winner is user - rgwb
We will be in touch

[Closed] Excel help

4 Posts
4 Users
0 Reactions
44 Views
 Elsa
Posts: 0
Free Member
Topic starter
 

If i have a very long column of data, each row in that column containing data, is there a way to insert a new row between each row without having to do it manually? The column is over a thousand rows in length.

Thanks


 
Posted : 05/08/2009 8:44 am
Posts: 0
Free Member
 

Something along these lines?
Change Range("A1:A100") to suit your data

sub insertrows()
Range("A1:A1000").Select
Dim myrange As Range
Dim NumRows As Integer
dim rowcounter as Integer

Set myrange = ActiveSheet.Range(ActiveWindow.Selection.Address)
NumRows = myrange.Rows.Count

for rowcounter = 2 to (numrows *2) step 2

Rows(rowcounter:rowcounter).Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

next rowcounter
end sub


 
Posted : 05/08/2009 9:01 am
Posts: 36
Free Member
 

here's a way without using VBA
http://www.pcmag.com/article2/0,2817,1785247,00.asp

using VBA, use the code

Sub insertrow()

Do While Not IsEmpty(ActiveCell)
ActiveCell.EntireRow.Insert
ActiveCell.Offset(2, 0).Select
Loop

End Sub


 
Posted : 05/08/2009 9:03 am
Posts: 0
Free Member
 

just tried this, works fine

Sub InsertBlankRow()
For r = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
Rows(r).Insert Shift:=xlDown
Next r
End Sub


 
Posted : 05/08/2009 9:06 am
 Elsa
Posts: 0
Free Member
Topic starter
 

Thanks guys - Macro works :)))


 
Posted : 05/08/2009 9:13 am