+ Reply to Thread
Results 1 to 2 of 2

Macro To Insert Empty Rows??

  1. #1
    Registered User
    Join Date
    02-03-2006
    Posts
    3

    Macro To Insert Empty Rows??

    anyone a dab hand at Excel? I need a had creating a macro. What i have is a column with numbers, for example

    12222
    12222
    21111
    21111
    13333
    13333

    what i need is a macro which will insert a blank row after an identical sequence of numbers, turning the above into

    12222
    12222

    21111
    21111

    13333
    13333


    any ideas?

  2. #2
    Paul B
    Guest

    Re: Macro To Insert Empty Rows??

    rtidrtid, here is one way, with data in column A

    Sub Insert_Row()
    Application.ScreenUpdating = False
    Dim Rng As Range
    Dim x As Long
    Set Rng = Range("A1:A" & Range("A65536").End(xlUp).Row)
    For x = Rng.Rows.Count To 2 Step -1
    If Rng.Cells(x, 1).Offset(-1, 0).Value <> Rng.Cells(x, 1).Value Then
    Rng.Cells(x, 1).Resize(1, 1).EntireRow.Insert Shift:=xlDown
    End If
    Next x
    Application.ScreenUpdating = True
    End Sub

    "rtidrtid" <rtidrtid.22nq7a_1138976400.6673@excelforum-nospam.com> wrote in
    message news:rtidrtid.22nq7a_1138976400.6673@excelforum-nospam.com...
    >
    > anyone a dab hand at Excel? I need a had creating a macro. What i have
    > is a column with numbers, for example
    >
    > 12222
    > 12222
    > 21111
    > 21111
    > 13333
    > 13333
    >
    > what i need is a macro which will insert a blank row after an identical
    > sequence of numbers, turning the above into
    >
    > 12222
    > 12222
    >
    > 21111
    > 21111
    >
    > 13333
    > 13333
    >
    >
    > any ideas?
    >
    >
    > --
    > rtidrtid
    > ------------------------------------------------------------------------
    > rtidrtid's Profile:
    > http://www.excelforum.com/member.php...o&userid=31148
    > View this thread: http://www.excelforum.com/showthread...hreadid=508117
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1