+ Reply to Thread
Results 1 to 2 of 2

Using a drop-down to hide/unhide rows and columns

  1. #1
    Registered User
    Join Date
    04-19-2024
    Location
    Hereford, England
    MS-Off Ver
    365
    Posts
    1

    Using a drop-down to hide/unhide rows and columns

    Hi, I'm new to the forum and I'm looking for some help on a spreadsheet I'm working on, I've spent a good number of hours trying to figure out how to achieve this using VBA(which I am new to).
    It is a training matrix and I would like to filter out training dates that are out of date/obsolete or require refresher training. Secondary, I would like to also be able to filter out columns and be able to apply the filter for out of date/obsolete or refresher training due specific for that column.

    A sample of the spreadsheet is at the bottom of this post.

    I've attempted to make the filtering of training status by adding columns DE and DF which count the dates as appropriate.

    In cell D2 is a drop-down that has a list of "All, Refresh & Obsolete". The desired outcome will be:

    All = Unhide rows (7 - 150)
    Refresh = Hide all rows (7 - 150) that do not contain a date that is counted as a refresher (conditionally formatted as yellow) - this will determined by the cell in DF being 0
    Obsolete = Hide all rows (7 - 150)that do not contain a date that is counted as a retrain (conditionally formatted as red) - this will determined by the cell in DE being 0

    The second objective is to add a second filter that will allow a name to be selected in cell G2 (data validated from headers in table, columns I - BF) and then filter out the training status, the problem with this is that you won't be able to use the counts in columns DE and DF because this is a count of everybody's training. So this may not be possible, but the below may be useful for figuring this out?

    The conditional formatting turns the cells yellow based off another cell which is smaller than today(). The formula for that cell is =IFERROR(IF(I9="","",VLOOKUP($E9,'.'!$C$2:$D$10,2,FALSE)+I9),"") - I have a tab called "." that contains a table to account for leap years and adds this to the date in the cell to get the date for refresher training.

    The conditional formatting that turns the cells red is simpler, it turns it red if the date in the cell is smaller than the date in column D.

    I may attempt to add in another filter later where I can view all the green training... but if the above is solved I shouldn't have any trouble adding that in.

    I appreciate any help and advice anyone can give on this.

    Edit - Sample Book1 was based off uncomplete version, I have updated this now:

    Book1.xlsm
    Last edited by Clear Skies; 04-19-2024 at 08:36 AM.

  2. #2
    Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    101

    Re: Using a drop-down to hide/unhide rows and columns

    You can do this using the activex combobox (use the Developer tab), I sent the style to be just a dropdownlist, and named it "drpTrainingStatus", then I added this code
    I can't run this code because changing the table area causes it to want to relink to external workbooks which I don't have. So, this code is untested.

    An alternative to just using the filter would be to loop the rows and hiding them one by one but that would be pretty slow.

    Please Login or Register  to view this content.
    In the ThisWorkbook, I added code to the Workbook_Open event of
    Please Login or Register  to view this content.
    Attached Files Attached Files

+ 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. Drop down and hide unhide rows
    By kwd53 in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 1
    Last Post: 02-25-2023, 02:11 PM
  2. [SOLVED] Hide/Unhide Columns based on Drop-down selection in different tab
    By RashmiD2930 in forum Excel General
    Replies: 18
    Last Post: 08-19-2020, 12:50 PM
  3. Hide/Unhide Columns with drop down menu
    By dgibney in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2020, 07:48 AM
  4. help please - hide unhide rows and columns based on drop down selection
    By iamgujju in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 07-01-2019, 10:56 AM
  5. Hide/Unhide Columns based on Drop-Down Selection
    By Khafez in forum Excel General
    Replies: 21
    Last Post: 09-14-2016, 12:13 PM
  6. Replies: 1
    Last Post: 02-01-2013, 03:06 PM
  7. Hide/unhide columns based on the drop down list value
    By vagif in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-16-2012, 02:13 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