+ Reply to Thread
Results 1 to 3 of 3

Delete & Move columns based on Heading content

  1. #1
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686

    Delete & Move columns based on Heading content

    I get a file that has too many columns in it and they are not in the correct order
    Here’s a condensed version of the macro to delete & rearange:

    Please Login or Register  to view this content.
    The problem is occasionally there are new columns added so the macro has to be manually changed.

    What I’d like to do is write code that deletes ALL columns whose headings (ROW 1) are not specified. Then rearrange them in the correct order.

    Example
    Spreadsheet arrives with the column headings of
    RED BLUE GREEN YELLOW BLACK WHITE

    Delete all columns except heading equals Red, Green, Black or Yellow
    (is there a limit to the columns headins I can list?)
    Column order should be
    Column 1 = Red
    Column 2 = Black
    Column 3 = Green
    Column 4 = Yellow

  2. #2
    Forum Expert
    Join Date
    11-23-2005
    Location
    Rome
    MS-Off Ver
    Ms Office 2016
    Posts
    1,628
    This code may solve your problerm:

    Please Login or Register  to view this content.

    What you need to do is to modify the block:
    HTML Code: 
    Regards,
    Antonio

  3. #3
    Forum Contributor
    Join Date
    08-14-2006
    Location
    USA
    MS-Off Ver
    2019
    Posts
    686
    Thank you - works like a charm

+ 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