ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   how to unhide a multiple sheets trigger by a checkbox (https://www.excelbanter.com/excel-programming/384789-how-unhide-multiple-sheets-trigger-checkbox.html)

Duboa

how to unhide a multiple sheets trigger by a checkbox
 
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

Martin Fishlock

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



All times are GMT +1. The time now is 03:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com