how to unhide a multiple sheets trigger by a checkbox

G

Guest

I have a protected workbook with only one sheet visible and the rest of them
hidden. I want to use a check box in sheet1 as a trigger to unhide xyz
sheets.

If chesk box value is True the sheets will be unhide if value is False
sheets should remain hidden
 
G

Guest

I inserted an activex checkbox and inserted the code in sheet1.


Private Sub CheckBox1_Change()
On Error Resume Next
ActiveWorkbook.Unprotect
ActiveWorkbook.Worksheets("xyz").Visible = Me.CheckBox1.Value '?????
ActiveWorkbook.Protect Structure:=True, Windows:=False
End Sub

you need to modify this for the sheets you want to hide or run a loop as in
for all the ones.

dim i as long
for i = 2 to worksheets.count step 1
ActiveWorkbook.Worksheets(i).Visible = Me.CheckBox1.Value
next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top