+ Reply to Thread
Results 1 to 5 of 5

Insert 2 new lines after same text is found

  1. #1
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    320

    Insert 2 new lines after same text is found

    Hi,

    If I have a excel 2003 file with a few rows/columns as follows

    1234B,AB900,1
    1234B,AB900,1
    1244A,AB901,1
    1267B,AB906,2
    1279B,AB915,1
    1279B,AB915,3
    1279B,AB915,1
    1288A,AB922,2

    Can it be changed to the following using VBA?

    1234B,AB900,1
    1234B,AB900,1


    1244A,AB901,1


    1267B,AB906,2


    1279B,AB915,1
    1279B,AB915,3
    1279B,AB915,1


    1288A,AB922,2

    Thanks for any help,

    David

  2. #2
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    31

    Re: Insert 2 new lines after same text is found

    hi

    If i've read it right, you want to insert a blank row (or do something) before each row that is not the same as the one above it (except the 1st). Is that right?

    if so, try this

    Please Login or Register  to view this content.
    apologies for it being a bit messy! Please get back to me if you'd like an explanation of anything, or if there's an error!

    cheers

    Mat

  3. #3
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    320

    Re: Insert 2 new lines after same text is found

    Hi Mat,

    Thanks for your response, you are correct but is it possible to create 2 empty rows in between each set?

    Thanks again,

    David

  4. #4
    Registered User
    Join Date
    01-12-2012
    Location
    UK
    MS-Off Ver
    Excel 2007/10
    Posts
    31

    Re: Insert 2 new lines after same text is found

    should be, just change this

    Please Login or Register  to view this content.
    to this

    Please Login or Register  to view this content.
    you will need to modify the line below to be j=j+2, don't think there is anything else, but there might be

    Cheers

    Mat

  5. #5
    Forum Contributor
    Join Date
    07-31-2012
    Location
    Los Angeles, USA
    MS-Off Ver
    2003, 2010, 365
    Posts
    320

    Re: Insert 2 new lines after same text is found

    That worked thanks for your help Mat.

+ 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