+ Reply to Thread
Results 1 to 7 of 7

Hide/Show rows based on drop down list

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    20

    Hide/Show rows based on drop down list

    First of all THANK you to all of you!! You have helped me many times throughout the years and just want to say Thanks!! Now my problem. Have been seaching here and the web and cant get much to work at what Im doing. I have tried Form Control and Active X Drop downs and Combo Boxes and cant get anything to work.

    What Im trying to do is if something is selected from the drop down it would then hide Rows 20:26 but if any other name is selected I would like it to unhide those rows 20:26. I have tried multiple VBA and can never get it to unhide or change with the drop down I always have to enter the number in the cell myself and the vba's work. I have attached an example.

    Using Excel 2010
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,882

    Re: Hide/Show rows based on drop down list

    For a worksheet change event to happen, the change has to be physically (manually) changed. A change as a result of a formula will not affect a worksheet change event. You may want to change the event to be triggered off some thing else (ie. Command Button?)
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Hide/Show rows based on drop down list

    Hi PvtJoker,

    See if this does what you want. If you put the dropdown in a cell instead of an object it is much easier. See the attached for how I'd do this problem.

    On Change Hide Rows.xlsm
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  4. #4
    Registered User
    Join Date
    01-13-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    20

    Cool Re: Hide/Show rows based on drop down list

    MarvinP

    Thank you so Much! That is exactly what I'm trying to do. Now Ill try and adapt that to the file I really need it on in the morning. If I cant get it to work I might be reaching out to you with hat file sometime tomorrow if you don't mind.

    Thanks Again!!

  5. #5
    Registered User
    Join Date
    01-13-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    20

    Re: Hide/Show rows based on drop down list

    Marvin P

    Ok in the VBA you have "If Not Intersect(Target, Cells(4, "G")) Is Nothing Then" but in my sheet that Im going to use this on the Cells E41:E42 are Merged and that is where the Data Validation list is located. I have changed the code from If Not Intersect(Target, Cells(4, "G")) Is Nothing Then to If Not Intersect(Target, Range("E41:E42")) Is Nothing Then and cant get it to work. I cant just do If Not Intersect(Target, Range("E:E")) Is Nothing Then Because I will have Validation on column E3 Rows 2, 15 28 Can this still be done?

    Here is the sheet so you can see what I'm trying to do.. So if the Data Validation in Cell E41:E42 is Blank it would hide Rows 42:48 but any other selection it would show Rows 42:48. Disregard the conditional formatting Ill fix that once this problem has been fixed LOL

    Thanks Again!
    Attached Files Attached Files

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,167

    Re: Hide/Show rows based on drop down list

    Hi,

    First, get rid of all those Merged Cells. It may look cool but you don't know what cell the data is going to be entered into.

    Then look how to debug your code by setting a breakpoint and stepping through it.

    http://www.cpearson.com/Excel/DebuggingVBA.aspx

    If that doesn't work and you need more, let me know..

  7. #7
    Registered User
    Join Date
    01-13-2011
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    20
    First off thanks for getting back to me.
    I will rework it and take out the merged cells out then I will start debugging if necessary after that . If I do need you after that I will reach out to you thanks again for the direction !

    QUOTE=MarvinP;4629612]Hi,

    First, get rid of all those Merged Cells. It may look cool but you don't know what cell the data is going to be entered into.

    Then look how to debug your code by setting a breakpoint and stepping through it.

    http://www.cpearson.com/Excel/DebuggingVBA.aspx

    If that doesn't work and you need more, let me know..[/QUOTE]

+ 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. Hide rows based on drop down list
    By soco3594 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-12-2017, 09:08 PM
  2. Hide rows based on muti cell drop down list
    By prat33 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-06-2017, 09:32 PM
  3. Macro to hide/show rows based on Drop Down selection
    By Bleucherie in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-03-2015, 06:14 PM
  4. [SOLVED] Show/hide rows based on drop down cell using named ranges
    By Stu091074 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 11:00 AM
  5. [SOLVED] hide or unhide rows based on text within a drop down list
    By souimet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2013, 01:32 AM
  6. [SOLVED] Macro Filter to hide rows based on Drop Down List
    By dieseldogpi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-12-2012, 11:19 AM
  7. 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

Tags for this Thread

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