+ Reply to Thread
Results 1 to 4 of 4

Insert Two Rows after change in column data

  1. #1
    Registered User
    Join Date
    02-04-2011
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Insert Two Rows after change in column data

    I have been using the following code to insert a blank row after a change of data in a column.

    Sub InsertRowAtChangeInValueCSR()
    Dim lRow As Long
    For lRow = Cells(Cells.Rows.Count, "F").End(xlUp).Row To 2 Step -1
    If Cells(lRow, "F") <> Cells(lRow - 1, "F") Then Rows(lRow).EntireRow.Insert
    Next lRow
    End Sub

    What would I change in order to insert two blank rows? If I simply run it twice it will insert three blank rows, but I would like just two.

    Thanks.

  2. #2
    Forum Expert MickG's Avatar
    Join Date
    11-23-2007
    Location
    Banbury,Oxfordshire
    Posts
    2,650

    Re: Insert Two Rows after change in column data

    Try:-
    Please Login or Register  to view this content.
    Mick

  3. #3
    Registered User
    Join Date
    02-04-2011
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: Insert Two Rows after change in column data

    Thank you very much. Exactly what I needed.

  4. #4
    Registered User
    Join Date
    02-04-2011
    Location
    toronto, canada
    MS-Off Ver
    Excel 2007
    Posts
    6

    Remove Rows with Data after Finding First Blank Row

    How would I go about removing any row that has cells with data, after fining the first blank row? So as you scroll down through the sheet and come to a blank row, delete any row after, which contains data.
    We have several spreadsheets that when generated, will have several blank rows and the a coupl rows of non essential data.
    Deleting 10 rows after the blank row would work.
    Any suggestions?

+ 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