Unhide Protected Sheets (not veryhidden)

DAT74

New Member
Joined
Jun 29, 2021
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
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!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
When protecting the structure (!!) of a workbook, both the order (relative position) and the visibility of the sheets cannot be changed.
 
Upvote 0

Forum statistics

Threads
1,214,613
Messages
6,120,515
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top