+ Reply to Thread
Results 1 to 5 of 5

VBA to hide groups of rows based on cell values

  1. #1
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    VBA to hide groups of rows based on cell values

    Hi - I've already posted today and had a reply which was amazing and worked. I've now finished building out my form and I've no clue how I can continue to build out the VBA I already have. I wish I understood them more.........

    This is what I need to achieve if anyone out there can help at all?

    Beginning

    If cell K26 is "Yes" or blank, then rows 27:106 need to be hidden. If "No" then rows 27:35 need to be visible and rows 36:106 hidden.


    If cell K35 is "Yes", then rows 37:44 need to be visible with rows 36 and 45:106 hidden, if "no" then rows 36 needs to be visible with 37:106 hidden

    If cell K36 is "Yes" then rows 37:67 and rows 82:106 need to be hidden. If "no" then rows 37:106 hidden


    If cell K43 is "Yes", then rows 45:51 need to be visible with rows 44 and 53:106 hidden, if "no" then rows 44 needs to be visible with 45:106 hidden

    If cell K44 is "Yes" then rows 45:67 and rows 82:106 need to be hidden. If "no" then rows 45:106 hidden


    If cell K51 is "Yes", then rows 53:59 need to be visible with rows 52 and 61:106 hidden, if "no" then rows 52 needs to be visible with 53:106 hidden

    If cell K52 is "Yes" then rows 53:67 and rows 82:106 need to be hidden. If "no" then rows 53:106 hidden


    If cell K59 is "Yes", then rows 61:67 need to be visible with rows 60 and 69:106 hidden, if "no" then rows 60 needs to be visible with 61:106 hidden

    If cell K60 is "Yes" then rows 61:67 and rows 82:106 need to be hidden. If "no" then rows 61:106 hidden


    If cell K67 is "Yes", then rows 68:80 need to be visible with rows 81:106 hidden, if "no" rows 68:106 hidden

    If cell K80 is "Yes", then rows 81:93 need to be visible with rows 94:106 hidden, if "no" rows 81:106 hidden

    If cell K93 is "Yes", then rows 94:106 need to be visible, if "no" rows 94:106 hidden

    End

    I'm not sure if it would be easier to group the rows which make up the sections into tables? But there's still the anomaly of where K44 will only show if K43 is "no" I don't know how that would work as a table.

    If anyone can help me I'll be eternally grateful - thank you.
    Attached Files Attached Files
    Last edited by DanielleP; 04-26-2023 at 07:07 AM.

  2. #2
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Please Help! :) VBA to hide groups of rows based on cell values

    Some of the rows are affected by more than one cell.

    For instance:
    K26 = Yes, then 27:106 is hidden
    K35 = Yes, then 37:44 is visible

    37:44 falls within 27:106, so what should happen if both K26 and K35 are Yes at the same time?

  3. #3
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Please Help! :) VBA to hide groups of rows based on cell values

    More complicated than I thought then. I want the form to open up rows based on the cell input.

    If K26 is Yes, the user will never see K35.

    Can I provide anything more that would help?

    Thanks

  4. #4
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,980

    Re: Please Help! :) VBA to hide groups of rows based on cell values

    Are you able to post a sample workbook?

  5. #5
    Registered User
    Join Date
    04-11-2023
    Location
    england
    MS-Off Ver
    MS365 version 2304
    Posts
    23

    Re: Please Help! :) VBA to hide groups of rows based on cell values

    Hi - I've attached a sample, thank you.

+ 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/unhide rows checkbox hide but doesn't unhide
    By windzor in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-08-2021, 11:51 AM
  2. Force unhide hidden rows where unhide not working
    By Halesowenmum in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2021, 07:05 AM
  3. Replies: 1
    Last Post: 11-04-2020, 06:48 PM
  4. [SOLVED] Macro to Hide rows with zeros in column E5:E50, then Unhide all rows
    By aaron061883 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-30-2019, 01:53 AM
  5. Need Toggle Button to hide/unhide rows based on cell value in non concurrent rows
    By The Phoenix in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-13-2015, 10:49 AM
  6. [SOLVED] First unhide all rows - then hide rows based on specific cell value for a range of cells
    By robbiekh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-22-2013, 05:46 PM
  7. How do i unhide rows that won't respond to 'unhide'?
    By sallyhughes in forum Excel General
    Replies: 1
    Last Post: 10-21-2010, 02:34 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