Share via

Excel Macros - Using Checkboxes to View/Hide Sheets

Anonymous
2018-05-22T02:14:25+00:00

Hi, 

I'm trying to use checkboxes to open/close sheets as they are ticked/unticked. The below formula works perfectly for the function I am using it for:

Sub CheckBox70_Click()

If Sheets("Index").Shapes("Check Box 70").ControlFormat.Value = xlOn Then

        Sheets("33.00 ATO Liabilities").Visible = xlSheetVisible

    Else

    Sheets("33.00 ATO Liabilities").Visible = xlSheetHidden

End If

End Sub

I am wanting to use the function so that when a checkbox is ticked, two sheets open at once. What do I add to the above code to do this? I have already tried adding the additional sheet like 'Sheets("33.00 ATO Liabilities" & "33.01 Rental Expenses"), which did not work. I tried adding a whole other line as follows which also didn' work:

Sheets("33.00 ATO Liabilities").Visible = xlSheetVisible

Sheets("33.01 Rental Expenses"). Visible = xlSheetVisible

Any ideas will be greatly appreciated as I am unable to find anything specific to this issue online. 

Thanks.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2018-05-22T02:46:04+00:00

I tested your code of:

Sheets("33.00 ATO Liabilities").Visible = xlSheetVisible

Sheets("33.01 Rental Expenses").Visible = xlSheetVisible

and it worked for me.

Double check your spelling of the pages, making sure extra leading or trailing spaces aren't there.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful