+ Reply to Thread
Results 1 to 9 of 9

Hide Columns that do not = drop down menu selection

  1. #1
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Hide Columns that do not = drop down menu selection

    I have a table with data that is sorted by the information I want to present in the columns and the data I want to filter by is on the top row (C2:W2). I want to be able to hide the columns that do not equal a drop down box I have. Is VBA the only way to accomplish this?

    Thanks,

  2. #2
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Hide Columns that do not = drop down menu selection

    Other than hiding via 'grouping' or something - but VBA would be the most flexible way to go. Can you post an example?


    Try this:

    Please Login or Register  to view this content.
    Without an example, I had to assign cell A2 the special 'drop-down' duty. See attached.
    Attached Files Attached Files
    Last edited by GeneralDisarray; 08-14-2015 at 08:32 AM. Reason: forgot to assign macro to button...
    Remember, saying thanks only takes a second or two. Click the star icon(*) below the post you liked, to give some Rep if you think an answer deserves it.

    Please,mark your thread [SOLVED] if you received your answer.

  3. #3
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Hide Columns that do not = drop down menu selection

    I sure can! So I just remade the work book with random data to post an example. Little explanation: I have the headers in B5:B9 that I want to be able to see and filter based on the combo box in B3 the columns C3:W2 based on the value that is equal to the combo box. Just want to hide the column if it's not equal to the selected value.

    Sample.xlsx

    Hope that makes sense

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

    Re: Hide Columns that do not = drop down menu selection

    Maybe:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Hide Columns that do not = drop down menu selection

    GeneralDissaray and John H. Davis,

    Thanks you so much, I used your code GeneralDissaray and it worked wonderfully just as I needed! thank again for the help! As always Excel help forum community made my day so much easier!

    Cheers!

  6. #6
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Hide Columns that do not = drop down menu selection

    Sorry one more thing! If I wanted to add an option in the drop down to un hide all to view all where would I add that? If the drop down menu item=8 unhide all rows in range

  7. #7
    Forum Expert GeneralDisarray's Avatar
    Join Date
    09-15-2011
    Location
    Pittsburgh, PA, USA
    MS-Off Ver
    Windows Excel 2016
    Posts
    1,416

    Re: Hide Columns that do not = drop down menu selection

    Just add a condition to check that the value is not equal to '8' prior to hiding:

    Please Login or Register  to view this content.

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

    Re: Hide Columns that do not = drop down menu selection

    For my suggestion:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    01-23-2014
    Location
    Canada
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Hide Columns that do not = drop down menu selection

    Perfect! Thanks again!

+ 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. VBA Hide/Unhide individual sheets based on selection in drop down menu
    By igullage in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-05-2015, 08:01 PM
  2. [SOLVED] VBA macro to hide/unhide particular worksheets on selection from drop-down menu
    By lealea1982 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2014, 09:51 AM
  3. [SOLVED] Hide rows from selection in drop down menu
    By TonyLB in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-27-2012, 11:34 AM
  4. [SOLVED] Vba to hide columns based on drop down selection
    By Nicola13 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-18-2012, 05:42 AM
  5. Hide a row based on a drop down menu selection
    By AMechEng in forum Excel General
    Replies: 4
    Last Post: 06-20-2012, 03:57 AM
  6. Excel 2007 : Hide Sheets using drop-down menu selection
    By SgtGrayMatter in forum Excel General
    Replies: 2
    Last Post: 03-18-2010, 01:29 PM
  7. drop down menu to select and hide certain rows and columns
    By ROM in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-11-2010, 09:39 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