Discussion Locked

CheckBoxes in Excel

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm not sure if this is the right place for my question but i'll ask anyway.

In Excel i want to add a CheckBox, when it is checked i want a certain amount of worksheets to become Hidden.

How do i do it?

Any help will be much appreciated.

1 reply

by pubservant

Try this.

Open an Excel worksheet. For this example, I used the default three sheets.
From the Control Toolbox add a CheckBox to Sheet1. Change the Name property to something appropriate such as "Hide Sheets".

The following code for the CheckBox Click method will hide Sheets 2 and 3 when the CheckBox is checked, and will display them when unchecked.

Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Sheet2.Visible = xlSheetHidden
Sheet3.Visible = xlSheetHidden
Else
Sheet2.Visible = xlSheetVisible
Sheet3.Visible = xlSheetVisible
End If
End Sub

This discussion is closed to new replies.