+ Reply to Thread
Results 1 to 9 of 9

Insert row on value change

  1. #1
    Forum Contributor
    Join Date
    11-04-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    334

    Insert row on value change

    I can insert a row where the value in column A changes, however I only want to insert the row where the value in column A changes from xx1 to xxx2.

    Where "xxx" can be any string



    Col A

    A1
    A1
    A1
    A2
    A2
    B1
    B1
    B1
    C2
    C2
    C1
    C1
    C2


    I want to be able to insert a row between A1 and A2, B1 and B2 but NOT between A2 and B1, B2 and C1 etc etc

    Any ideas?

    I have attached a small sample.

    Thanks.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Insert row on value change

    Maybe:

    Please Login or Register  to view this content.

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

    Re: Insert row on value change

    Try this:-
    NB:- At the moment, this will only work on Data with 2 character strings
    Please Login or Register  to view this content.
    Regards Mick

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

    Re: Insert row on value change

    This code is better, it caters for instances where there are multiple rows one after the other that need a blank row inserting.
    Please Login or Register  to view this content.
    Regards Mick

  5. #5
    Forum Contributor
    Join Date
    11-04-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    334

    Re: Insert row on value change

    Thanks John H and MickG I will give your code a try.

  6. #6
    Forum Contributor
    Join Date
    11-04-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    334

    Re: Insert row on value change

    Thanks again John H & Mick G, your code does the job.

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Insert row on value change

    You're welcome. Glad to help out and thanks for the feedback.

  8. #8
    Registered User
    Join Date
    11-05-2013
    Location
    Toronto
    MS-Off Ver
    Excel 2007
    Posts
    1

    Re: Insert row on value change

    Hi Mick G.

    I have a similar issue that your code can resolve. The diffference however is that I want an Enitre Row to be inserted as there will be data in other columns (B, C, D, ....).

    What change should be made in insert rows across multiple colums?

    Thanks
    Yorelsemaj

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

    Re: Insert row on value change

    Add "Entirerow", in code, where show below:-
    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Insert Row at each data change
    By hnoshea in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-23-2013, 02:02 PM
  2. [SOLVED] Insert Row at Column value change and...
    By saniamarco in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2012, 05:56 PM
  3. Insert row at date change
    By Annelie in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-01-2010, 08:19 PM
  4. Copy paste data, insert rows, insert data and change . to -
    By xWiZardx in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-16-2010, 01:44 AM
  5. Replies: 2
    Last Post: 02-27-2006, 11:55 AM

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