+ Reply to Thread
Results 1 to 4 of 4

Hide rows based on a list value

  1. #1
    Registered User
    Join Date
    12-15-2014
    Location
    Bath, UK
    MS-Off Ver
    2010
    Posts
    2

    Hide rows based on a list value

    Hi,

    I'm a complete rookie to non basic excel so please excuse that. I'm trying to organise a database of text information and what I would like to do is have a drop down list with a number of topics (e.g Characterisation, Treatment) which relate to information across a number of columns (so title of the paper, key points, reference info etc). So when I select Treatment on the list all of the relevant information will be unhidden in rows 5-30 and if it is not selected those rows are hidden. Then if I select Characterisation rows 31-50 are unhidden and all other rows are hidden so I can only see the information relating to that topic.

    I have my drop down list and I understand I need to write a macro in order to hide/unhide the rows based on this list. So say the list is in A2 and all of my information is in rows 3-100 - I need my macro to hide/unhide those rows based on what is selected from the drop down list. Hopefully my explanation was clear enough.

    If you can please explain the macro and how to implement it that would be most useful. I'd rather learn how to use the macro so I can edit it in future rather than just copying and pasting something. Thanks in advance for any advice.

    Graham

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Hide rows based on a list value

    You don't need a macro to do this, and it's probably easier, too. Just have a column which contains the label you want for each row (Characterization, Treatment, etc.), Then turn on a filter for that column (Data -> Filter), then using the drop down for that column, select the category (or catergories) you want to view.

    A macro can be written for this functionality, but since you're already talking about having a listbox, writing code seems a bit of overkill.

  3. #3
    Registered User
    Join Date
    12-15-2014
    Location
    Bath, UK
    MS-Off Ver
    2010
    Posts
    2

    Re: Hide rows based on a list value

    That does sound like a better method. Do you mind explaining a little more on how to implement that because I've played around with the advanced filter but cant seem to achieve the result I want. Is it better to go about it the same way I described in my post or in another way?

    Thanks for your help.

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Hide rows based on a list value

    Right. So you don't need to use the advanced filter, just the regular filter.

    Like I said, you're going to need a column that's explicitly for the category. Let's say you choose column D (but can be whatever blank column you want). So from your example, in rows 5 through 30 you will enter the word "Treatment" in column D. Rows 31-50 in column D you'll enter "Characterization" etc. etc. etc.

    Now click the top cell in that column, Data -> Filter, then click the little drop-down arrow in that cell. Viola, you can show/ hide whatever catergories you want by clicking the check boxes.

+ 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] Hide Rows based off items from a ComboBox List.
    By Glitch_ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-17-2014, 09:27 AM
  2. Hide Rows Based on Selection in Form List Box
    By mpluers in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-05-2013, 03:58 AM
  3. Hide Rows Based on List Value from Cell
    By ahill in forum Excel General
    Replies: 3
    Last Post: 06-15-2012, 12:25 PM
  4. Hide Rows based on Client Drop Down List
    By troyhalsey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2012, 07:28 AM
  5. Hide Rows based on dropdown list in another sheet
    By Jeeperman4x4 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-04-2011, 08:01 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