+ Reply to Thread
Results 1 to 4 of 4

Delete columns - Prioritise columns with specific headers

  1. #1
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Delete columns - Prioritise columns with specific headers

    Hi,

    I have a macro that import's a csv file with various headers/columns. Sometimes there are slight variations on the columns of data imported and I would like a macro to favour certain columns if they exist, and delete other similar columns.

    For example:
    If both columns with the headers 'QUANTITY SUBMITTED' & 'ACCEPTED QUANTITY' exist then I want to delete the 'ACCEPTED QUANTITY' column.
    However, sometimes only 'ACCEPTED QUANTITY' will exist- in this case I would want to keep it.

    Does anyone have any ideas as to how I might achieve this?

    Thanks!
    Last edited by BPSJACK; 09-10-2015 at 07:09 AM.

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Delete columns - Prioritise columns with specific headers

    Hi there,

    Try the following code and see if it does what you need:

    Please Login or Register  to view this content.
    The highlighted values can be changed to suit your own worksheet name and layout.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  3. #3
    Forum Contributor
    Join Date
    01-06-2012
    Location
    London, England
    MS-Off Ver
    2013
    Posts
    165

    Re: Delete columns - Prioritise columns with specific headers

    That works brilliantly, thank you!!

  4. #4
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Delete columns - Prioritise columns with specific headers

    Hi again,

    You're very welcome - pleased to have been able to help.

    Many thanks for your feedback and also for the Reputation increase.

    Best regards,

    Greg M

+ 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] Delete blank columns with headers
    By kingsp in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-01-2014, 04:26 PM
  2. [SOLVED] Delete All Blank Columns with Sheet that has Headers
    By desertshore in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-12-2013, 06:55 PM
  3. Delete 1 to 8 rows. Do text to columns to specific columns.
    By niceblue in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-06-2013, 10:53 AM
  4. [SOLVED] Delete entire Columns based on different Headers (Array)
    By WITJ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-13-2013, 02:46 PM
  5. Macro to delete all columns except specified headers
    By macattackr in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-07-2013, 12:44 PM
  6. VBA look for the average for each row with columns with specific headers.
    By dimer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-08-2011, 12:31 PM
  7. Delete Columns with duplicate headers
    By Casey in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-05-2006, 10:10 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