+ Reply to Thread
Results 1 to 7 of 7

Hiding columns by selecting from dropdown validation list

  1. #1
    Registered User
    Join Date
    11-06-2014
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    3

    Thumbs up Hiding columns by selecting from dropdown validation list

    Hello,

    I could use some help, i have created a dropdown list by listing 8 different options. I selected the cell i want the dropdown to be (C2) then selected data validation-> list and selected the 8 different options as the range. So far it works, i now have 8 different options in a dropdown list in cell C2.

    In my sheet i have fixed colums A to D. The other columns contains the 8 different options, i would like to only show the columns for the option selected in the dropdown list. So if i select "food" from the dropdown in C2 i would like to hide columns N to T, and show columns E to M. Same for "drinks": hide E to M and T to Z, only show N to T and so on. If nothing is selected in C2 i would like for all columns exept A to D to be hidden. Any help with this would be much appreciated

  2. #2
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: Hiding columns by selecting from dropdown validation list

    How many total columns are in use after A:D? From E to...?

  3. #3
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: Hiding columns by selecting from dropdown validation list

    I made a simple macro which requires you to press a button to check for the value in C2. Depending on the value it shows/hides designated columns. If this kind of solution works for you and you are familiar with VBA, you can adjust the code to suit your needs.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-06-2014
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    3

    Re: Hiding columns by selecting from dropdown validation list

    How many total columns are in use after A:D? From E to...?
    fixed colums A:D, then colums E:BI

    U sir are a lifesaver, thanks for your help. I have used your macro and adjusted the values for the columns to my needs and it works :-) As you may have noticed i'm new to VBA and macro's for that matter. Their is just one thing, i have selected shortkey for running the macro so i now select a option from the drop down press shift+ctrl+Q and then it hides/shows the correct columns. Is there a way to bypass using the shortkey so i only have to select a option from the dropdown and then the correct column shows without using the shortkeys? I have a feeling this is basic stuff but i'm just getting the hang of things so all help is very much welcome

  5. #5
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: Hiding columns by selecting from dropdown validation list

    I am also a VBA noobie, but I gather your request would require the macro to be running constantly, without the need to run it, which, I believe, is not possible.

  6. #6
    Registered User
    Join Date
    11-06-2014
    Location
    Belgium
    MS-Off Ver
    2010
    Posts
    3

    Re: Hiding columns by selecting from dropdown validation list

    Thanks for your reply, well i guess we can't have everything.
    You deserve a trophy for helping me out on such short notice

  7. #7
    Forum Contributor
    Join Date
    08-04-2014
    Location
    Riga
    MS-Off Ver
    2010
    Posts
    579

    Re: Hiding columns by selecting from dropdown validation list

    Glad to help, good luck

+ 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. Selecting a value from a dropdown list (data validation) which will populate cells..
    By milkychips in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-09-2012, 09:07 PM
  2. Replies: 0
    Last Post: 08-22-2012, 03:52 PM
  3. Hiding/Unhiding columns based on a dropdown list
    By jim_0068 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-12-2007, 11:57 AM
  4. result of selecting from the dropdown list should be a dropdown list
    By No News in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-05-2006, 11:15 AM
  5. [SOLVED] result of selecting from the dropdown list should be a dropdown list
    By No News in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-01-2006, 05:55 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