Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: INSERT A ROW AFTER LIKE SETS OF DATA

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    OKC
    Posts
    98
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    i have a column of like sets of data. can a macro be written to insert a blank row at the end of each set of like data:

    1966
    1966
    1966

    1988
    1988
    1988

    1921
    1921
    etc. etc.

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try the following:

    Sub InsertBlankRows()
    Dim ColOfData As Integer
    ColOfData = 1
    For i = ActiveSheet.UsedRange.Columns(ColOfData).Rows.Count To 1 Step -1
    If Cells(i, ColOfData) <> Cells(i + 1, ColOfData) Then _
    Cells(i + 1, ColOfData).EntireRow.Insert
    Next i
    End Sub

    Change ColOfData to the number of the column that holds your data (ie 1=A, 2=B)
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    OKC
    Posts
    98
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    after it spasmed for a few minutes, it worked wonderfully, thank you very much

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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