+ Reply to Thread
Results 1 to 4 of 4

Keep/Delete a column based on Title, not letter

  1. #1
    Registered User
    Join Date
    06-25-2010
    Location
    Chi Town
    MS-Off Ver
    Excel 2007
    Posts
    13

    Keep/Delete a column based on Title, not letter

    I am currently trying to reduce hundreds of columns of data using a macro in Excel 2007. Currently, my macro defines certain columns (A, B, C) to delete. However, every time we collect new data, the columns may change. Instead of selecting a column based on its letter and deleting it, I was wondering if you could:
    • Find a column based on it's title (ex. find by title "CBPR1" instead of "Column A")
    • Define the names of all of the columns I would like to keep instead of delete (ex. find and keep "CBPR1, CBPR2, etc." instead of find and delete "Column A, B, etc.")

    Just to make it more clear, and example is if CPBR1 is now in Column B instead of AA. I just want to alter my code so that I only need to define which columns I want to keep based on the text in the first line, rather than the column letter. I would also like to keep all of the columns I define and delete everything else instead of the other way around. Thanks
    Last edited by elementalsurf7; 12-22-2010 at 01:19 PM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Keep/Delete a column based on Title, not letter

    there are different ways to make it (not limited with provided below), for example:

    http://www.excelforum.com/excel-prog...ate-sheet.html

    If you attach dummy book with example it would be easier to go in details.

  3. #3
    Registered User
    Join Date
    06-25-2010
    Location
    Chi Town
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Keep/Delete a column based on Title, not letter

    Thanks for the reply. I will check it out. But in the meantime I have also attached a sample book with my two macros. The only problem with the book I uploaded is that I removed all of the names of the columns, making it kind of difficult to explain how to find "COMMAND" when they are all labeled that. If you want, just replace "COMMAND" with any dummies. Thanks for the help.

    Edit: Data Reduction is the one I'm interested in. CustomChart is irrelevant
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Keep/Delete a column based on Title, not letter

    please provide sheet with original data and result data (preserving column titles)
    Last edited by watersev; 12-22-2010 at 01:50 PM.

+ 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