+ Reply to Thread
Results 1 to 4 of 4

how to hide all columns who's header name matches a single column list, in the same sheet.

  1. #1
    Registered User
    Join Date
    07-22-2005
    Location
    canada
    Posts
    73

    how to hide all columns who's header name matches a single column list, in the same sheet.

    Hello,
    I've got a worksheet with 300+ columns (they are the field names from a database). This sheet is only used to build reference lists from each column. However, to keep the sheet easier to be used, I want to hide the columns that are currently not needed (but I don't want to delete the column). It should be noted that these columns are NOT in one contiguous large group, but are spread out through the whole sheet).

    The worksheet is called REFDATASHT as its code name, "REF" as its visible name.
    I have Column A in said sheet that is a list of all the columns that I want to hide.

    I've thought about populating an array with the list from Col A, and the look through the headers of the entire worksheet, and then hide that column if found.

    I'm mostly wondering if someone knows of a more efficient way to do this, here's a pseudo flow of how I'd do this:
    Please Login or Register  to view this content.
    Id likely set this to run when that sheet is visible or takes focus.

    Is there a more efficient way to do this?

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to hide all columns who's header name matches a single column list, in the same sh

    Like so:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: how to hide all columns who's header name matches a single column list, in the same sh

    This is the version that self-activates, put this in the sheet module:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    07-22-2005
    Location
    canada
    Posts
    73

    Re: how to hide all columns who's header name matches a single column list, in the same sh

    Quote Originally Posted by JBeaucaire View Post
    This is the version that self-activates, put this in the sheet module:
    Please Login or Register  to view this content.
    Dude!

    This is perfect! 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)

Similar Threads

  1. [SOLVED] Process to Highlight Entire Row if one field matches # on a single column of a dif sheet
    By deeproots79 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-10-2016, 09:14 PM
  2. Hide/show columns based on the year in the header of the column
    By lukelucky in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-19-2015, 04:03 AM
  3. Replies: 1
    Last Post: 10-05-2013, 03:35 PM
  4. Get the column Header where value matches in multible columns
    By paddudommeti in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-30-2013, 03:36 AM
  5. Macro Required - Hide columns where cell in a single column is empty
    By heatwave in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-04-2012, 12:53 AM
  6. How to hide all empty columns without including the column header
    By mkingsberry in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-09-2010, 12:27 PM
  7. Copy columns from one sheet to another if the header matches
    By Newbie111 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-20-2010, 12:58 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