+ Reply to Thread
Results 1 to 23 of 23

Show/Hide Range based on multiple Criteria

  1. #1
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Show/Hide Range based on multiple Criteria

    I have explained in attached.
    Criteria to Show/Hide are in D2:D6
    "X" in D2:D6 mean Show Range, Nothing in D2:D6 mean Hide all
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Show/Hide Range based on multiple Criteria

    Hi, this could do the trick:
    Please Login or Register  to view this content.
    Cheers
    Erwin
    I started learning VBA because I was lazy ...
    Still developing.... being more lazy...

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Show/Hide Range based on multiple Criteria

    You are complicating this by using merged cells which most of us avoid.
    Are you able to hold A1 in B9:B13, A2 in B14:B16...etc?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi ! Try this !


    According to the attachment as it is except cells from A7 to K7 must be empty
    - for a smart enough worksheet as the better place for comments is the initial post rather than in a worksheet -
    a VBA beginner starter :

    PHP Code: 
    Sub Demo1()
             
    Dim VR
             Application
    .ScreenUpdating False
        With 
    [B8].CurrentRegion.Rows
                 
    .Item("2:" & .Count).EntireRow.Hidden True
            
    For Each V In Filter([TRANSPOSE(IF(D2:D6="X",C2:C6))], FalseFalse)
                
    Application.Match(V, .Columns(1), 0)
                If 
    IsNumeric(RThen .Cells(R1).MergeArea.EntireRow.Hidden False
            Next
        End With
             Application
    .ScreenUpdating True
    End Sub 
    ► Do you like it ? ► ► So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Hi ! Try this !

    Please see attached, I can not make it work !
    My Options are hidden now !
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor Eastw00d's Avatar
    Join Date
    02-29-2020
    Location
    Breda, NL
    MS-Off Ver
    2016, 2019
    Posts
    833

    Re: Show/Hide Range based on multiple Criteria

    Please see my attachment
    Cheers
    Erwin
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow

    Quote Originally Posted by ionelz View Post
    Please see attached, I can not make it work !
    My Options are hidden now !
    Your bad ! Just well read post #4 …

  8. #8
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: Hi ! Try this !

    Un-hide all the rows and try:
    Please Login or Register  to view this content.
    Last edited by Mumps1; 03-15-2020 at 10:35 AM.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  9. #9
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    For me do not work.
    Maybe I did not explain good.

    Say, there is only one "X" in D2
    I want to show Range A1, which are Rows 9 to 13 and Hide bellow 13

    Say, there are "X" in D3 and D5
    I want to Show Range B1 which are Rows 14 to 16 and Range D1 which are Rows 23 to 24

  10. #10
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Re: Show/Hide Range based on multiple Criteria


    Well works on my side with the initial attachment according to post #4 directions
    Last edited by Marc L; 03-15-2020 at 10:45 AM.

  11. #11
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: Show/Hide Range based on multiple Criteria

    Have you tried the macro I suggested in Post #8?

  12. #12
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    Could you please attach back with your code from post 8 ?
    Maybe I did not explain well but I want to Hide/Show "Rows Range" based on "X'" from D2:D6

    "X" in D2 mean SHOW Row 9 to 13 and Hide Row 14 to 27

    "X" in D2 and D4 mean SHOW Row 9 to 13, Row 17 to 22 and Hide the remaining
    Last edited by ionelz; 03-15-2020 at 11:19 AM.

  13. #13
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: Show/Hide Range based on multiple Criteria

    Try the attached file.
    Attached Files Attached Files

  14. #14
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    Thank you, I not sure what is wrong !
    It work when download but then it doesn't
    After a few adding /removing "X" it stop working
    Sorry ! I may do someting wrong ...

  15. #15
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    Sorry, one moment please, looks like X was case sensitive !!!!!
    THAT IS EXACTLY WHAT I WAS LOOKING FOR !

    Could you PLEASE, reverse ! so it work the opposite !?
    Right now, if all are X then all are hidden

    I want X to show not to hide, if there is no X all are Hide, as soon as one X is in then Show
    Last edited by ionelz; 03-15-2020 at 11:36 AM.

  16. #16
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: Show/Hide Range based on multiple Criteria

    Just change "True" to "False" in the code. (without the quotes)

  17. #17
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Show/Hide Range based on multiple Criteria

    Here's one way

    Please Login or Register  to view this content.

  18. #18
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    I have noticed that, if A1 is MERGED (b9:b13), then it doesn't work !
    So, if all are X and A1 is MERGED, than A1 stay (do not work)
    If I UNMERGE A1 then it work !

  19. #19
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    Eastw00d, could you PLEASE reattach with your Code

  20. #20
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    Richard, super cool !
    Thank you

  21. #21
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: Show/Hide Range based on multiple Criteria

    Try:
    Please Login or Register  to view this content.

  22. #22
    Forum Contributor
    Join Date
    05-20-2016
    Location
    Detroit
    MS-Off Ver
    Office 365 Version 2008 (July 2020)
    Posts
    819

    Re: Show/Hide Range based on multiple Criteria

    Thank you, thank you for this second option...

  23. #23
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,844

    Re: Show/Hide Range based on multiple Criteria

    My pleasure.

+ 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] Show/Hide Rows Columns based on value in named range
    By Andrew-Mark in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-21-2016, 07:13 AM
  2. [SOLVED] Auto-hide/show Rows based on Yes/No Criteria
    By jakeruby in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-20-2015, 04:04 PM
  3. Show/Hide sheets based on values of cells in a range
    By Happytobe in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 05-12-2014, 04:52 PM
  4. Code to show/hide columns based on fixed criteria
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-07-2013, 03:39 AM
  5. Show/Hide Specific set of Rows based on Criteria in one cell
    By mrgillus in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-11-2010, 01:26 PM
  6. Hide / Show lines Based on Criteria
    By Rage in forum Excel General
    Replies: 7
    Last Post: 02-17-2010, 12:09 PM
  7. Hide/show specific Pivot Table Items based on multiple criteria
    By wotadude in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2009, 05:15 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