Results 1 to 8 of 8

VBA to add a blank row between entries

Threaded View

  1. #1
    Registered User
    Join Date
    06-14-2011
    Location
    Princeton, NJ
    MS-Off Ver
    Excel 2007
    Posts
    3

    VBA to add a blank row between entries

    First off: Windows 7 and Excel 2010

    I have a massive spreadsheet and need to put a blank row after entries when the information in column T changes. Let's say the following is column T.

    Blue
    Blue
    Blue
    Red
    Red
    Red
    Yellow

    I want to insert a blank row after the 3rd Blue and 3rd Red and so on........ Below is the VBA someone gave me to try in Excel 07 and it worked perfectly. Perhaps it will help with your answer. It does not work in Excel 2010. Thank you in advance.

    Sub test()
        Columns("u").Insert
        Columns("u").Clear
        With Range("t2", Range("t" & Rows.Count).End(xlUp)).Offset(, 1)
            .Formula = "=if(and(t1<>"""",t2<>"""",t1<>t2),if(u1=1,""a"",1),"""")"
            .Value = .Value
            On Error Resume Next
            .SpecialCells(2, 1).EntireRow.Insert
            .SpecialCells(2, 2).EntireRow.Insert
            On Error GoTo 0
        End With
        Columns("u").Delete
    End Sub
    Last edited by Cutter; 07-31-2012 at 10:11 AM. Reason: Added code tags

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