Viewing 5 posts - 1 through 5 (of 5 total)
  • Excel help
  • Elsa
    Free Member

    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

    mossimus
    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

    Stoner
    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

    tragically1969
    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

    Elsa
    Free Member

    Thanks guys – Macro works :)))

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘Excel help’ is closed to new replies.