Hello all,
I am putting finishing touches on a company directory database which has a menu page to call sheets based on desired department. I am trying to protect the sheets from editing, but still have the macros call the hidden/protected sheets.
In the Workbook code, I have the following (NOTE: protects all sheets except "MENU"):
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "MENU" Then
ws.Protect Password:="password", DrawingObjects:=True, Contents:=True, Scenarios:=False
End If
Next ws
ActiveWorkbook.Protect Password:="password", Structure:=True, Windows:=False
End Sub
When I open the Workbook (auto-protected), I click the cells that normally call the hidden sheets (while unprotected), and get the following error:
Run-time error '1004':
Unable to set the Visible property of the Worksheet class
I hope that this query makes any sense at all....any advise is truly appreciated!
I am putting finishing touches on a company directory database which has a menu page to call sheets based on desired department. I am trying to protect the sheets from editing, but still have the macros call the hidden/protected sheets.
In the Workbook code, I have the following (NOTE: protects all sheets except "MENU"):
Private Sub Workbook_Open()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> "MENU" Then
ws.Protect Password:="password", DrawingObjects:=True, Contents:=True, Scenarios:=False
End If
Next ws
ActiveWorkbook.Protect Password:="password", Structure:=True, Windows:=False
End Sub
When I open the Workbook (auto-protected), I click the cells that normally call the hidden sheets (while unprotected), and get the following error:
Run-time error '1004':
Unable to set the Visible property of the Worksheet class
I hope that this query makes any sense at all....any advise is truly appreciated!