+ Reply to Thread
Results 1 to 4 of 4

Insert columns where there is a break in sequence

  1. #1
    Registered User
    Join Date
    04-11-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2010
    Posts
    76

    Insert columns where there is a break in sequence

    Hello all,

    Would appreciate help with a macro for this task that I do on a regular basis, but manually. I have an array of data with column headers that start with numerals and end with text (ex "01Attitude - Good"). The columns are in numerical order from left to right, going up to 49. I need a macro that inserts columns whenever there is a break in numeric sequence. In other words, if there are two columns next to each other that are named "16ABC" and "18XYZ", the macro would insert a column between them (creating a 'ghost' 17 column). Or if there were multiple numbers missing, e.g. "29ABC" and "32XYZ" next to each other, it would insert as many columns as necessary to correct the numeric sequence (in this case, two columns).

    I've attached a document to show what I'm starting with. End result would be on the same sheet, but with inserted columns where the breaks are.

    Thanks much,

    Matt
    Attached Files Attached Files

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert columns where there is a break in sequence

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    04-11-2012
    Location
    Nashville, TN
    MS-Off Ver
    Excel 2010
    Posts
    76

    Re: Insert columns where there is a break in sequence

    That worked! Thanks xladept!

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Insert columns where there is a break in sequence

    You're welcome and thanks for the rep!

+ 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. insert missing values in a sequence
    By newexcel123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-02-2014, 07:19 AM
  2. [SOLVED] Insert row when a row in the sequence is missing
    By mhelmers in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-29-2013, 10:58 AM
  3. Insert blank row, sum and insert page break macro
    By kim5012 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2012, 01:46 AM
  4. Insert Row where break in sequence, Copy data
    By crownent in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-02-2012, 12:49 PM
  5. break in # sequence
    By ice in forum Excel General
    Replies: 1
    Last Post: 01-28-2010, 04:26 PM

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