1 Checkbox to hide then unhide multiple sheets.

  • Hello everyone. I have a WB with about 26 sheets. On the home page I want a checkbox that hides approx. 20 of them when checked and unhides them when unchecked. I have started my code with just 3 sheets until I get it right. Right now it will hide them but it wont unhide them. Any ideas? I tried many online postings for the code (I dont have VBA skills) - none worked exactly - this one I managed to get the hide part working but am still at a loss on the unhide.


    Code
    Private Sub CheckBox2_Click()
    If CheckBox2.Value = True Then
    Sheets(Array("ELECTRICAL", "PLUMBING", "LISTS")).Visible = False
    Else
    Sheets(Array("ELECTRICAL", "PLUMBING", "LISTS")).Visible = True
    End If
    End Sub


    Thanks so much for any help!!

  • Re: 1 Checkbox to hide then unhide multiple sheets.


    It's an issue that has come up before and seems to be one of those 'things' in Excel - one workaround:

  • Re: 1 Checkbox to hide then unhide multiple sheets.


    Hi, Thank-you so much!! I spent about 6 hours online yesterday trying to find anything that would work. Yours works!! It does a huge shudder of the screen when it does it that is disconcerting - any way to smooth it out? If not I am still so grateful that now I can at least make it happen. C

  • Re: 1 Checkbox to hide then unhide multiple sheets.


    try adding

    Code
    Application.ScreenUpdating = False


    at the beginning of the code and add

    Code
    Application.ScreenUpdating =True


    at the end of the code

  • Re: 1 Checkbox to hide then unhide multiple sheets.


    Wow that was the final thing - smooth as silk!! Thanks so much. Awesome help - what an excellent site with really nice and helpful people!!

  • Re: 1 Checkbox to hide then unhide multiple sheets.


    So I have my 1st check box working fine to hide/unhide a series of rows (11-193) . On some of those rows in middle I have several more checkboxes that hide and unhide a few rows. When I check and uncheck the 1st check box the follow on effect is that the other checkboxes don't hide with the rows (see pic 2). They shift down to the bottom to where the first row showing is . When I uncheck again they go back up to the row they are supposed to sit (see pic 1) on but they stop working and cannot be selected. A steer in the right direction would be so helpful.





    [ATTACH=CONFIG]70645[/ATTACH][ATTACH=CONFIG]70646[/ATTACH]



    Moderator Note: I have added code tags for you. Please read the forum rules you agreed to and please observe the few that we require.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!