View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Martin Fishlock Martin Fishlock is offline
external usenet poster
 
Posts: 694
Default how to unhide a multiple sheets trigger by a checkbox

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 Structu=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



--
Hope this helps
Martin Fishlock, Bangkok, Thailand
Please do not forget to rate this reply.


"Duboa" wrote:

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