+ Reply to Thread
Results 1 to 6 of 6

Macro to delete columns except selected columns

  1. #1
    Registered User
    Join Date
    11-18-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Macro to delete columns except selected columns

    Hi,

    I need a macro that will delete all columns except 5 columns that I identify by Header Name.

    Please help on this.

    Thanks,
    Vikas
    Last edited by VKR; 01-07-2013 at 09:56 AM.

  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: Macro to delete columns except selected columns

    I know there must be a better way.

    Please Login or Register  to view this content.

    Replace the letters with your Header names and expand the Columns range to suit

  3. #3
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to delete columns except selected columns

    Hi Vikas

    See this link...the code does just as you describe...if you need help adapting let me know
    http://www.vbforums.com/showthread.p...delete-columns
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  4. #4
    Registered User
    Join Date
    11-18-2011
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    17

    Re: Macro to delete columns except selected columns

    It works...Thanks to both..

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

    Re: Macro to delete columns except selected columns

    To VKR you're welcome.

    To jaslake. No problems from me. It a good policy and learning experience to see different ways to solve problems.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Macro to delete columns except selected columns

    @Vikas
    You're welcome...glad I could help. Thanks for the Rep.

    @JOHN H. DAVIS
    There's always more than one way.

+ 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