Unable to Update the WS.Visible Property on Multiple Sheets

tjdrake

New Member
Joined
Aug 2, 2022
Messages
19
Office Version
  1. 2021
Platform
  1. Windows
Greetings!

I have multiple sheets that I have xlVeryHidden. Interestingly, I've recently started getting an err when trying to present the sheets. So, I checked the property of the worksheets using the Properties Window, and I am unable to change it there either. So, to further check to see if the sheet was protected, I put the sheets ProtectionContents status in the code just to check it... a no go... it isn't protected, nor is the structure of the WB...

Any ideas on what I may have accidentally set to cause this?

Thank you, in advance, for your assistance.

Regards,
tjd

1679325837136.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Hi
welcome to forum
It would be helpful if you can post your code using code tags - Menubar > VBA
paste your code between the tags - plenty here to assist you

Dave
 
Upvote 0
Does it happen on all sheets, or just that one?
 
Upvote 0
Greetings!

I have multiple sheets that I have xlVeryHidden. Interestingly, I've recently started getting an err when trying to present the sheets. So, I checked the property of the worksheets using the Properties Window, and I am unable to change it there either. So, to further check to see if the sheet was protected, I put the sheets ProtectionContents status in the code just to check it... a no go... it isn't protected, nor is the structure of the WB...

Any ideas on what I may have accidentally set to cause this?

Thank you, in advance, for your assistance.

Regards,
tjd

View attachment 87921

Additional information from the Watch Window.
1679327592048.png
 
Upvote 0
Only those that are in xlVeryHidden. Here's the code... super simple. I use the Unhide All routine for diagnostic and development work within this workbook. It wasn't until after I added the "If ws.ProtectContents" line that things went haywire. Hence, the reason that I thought that there were protection related issues. As noted previously, I've not been able to change it in the Properties Window for any of the WSs either. Thank you.

Sub ToggleHideUnhideDataSheets(Toggle)

Dim wb As Workbook
Dim ws As Worksheet

Set wb = ThisWorkbook

For Each ws In Worksheets
Select Case Trim(ws.Name)
Case "Instructions", "parms", "Lookback", "7-Day Plan", "PvA"
If ws.ProtectContents = True Then ws.Unprotect ("pswd") Else ws.Protect ("pswd")

' These sheets should always be visible
If Toggle = "Show" Then ws.Visible = xlSheetVisible

Case "Cycle Activity Week", "ALP_Volume", "ALPS PP Rates", "Station", "SSPOT Roster", "Stations"
If Toggle = "Show" Then ws.Visible = xlSheetVisible Else ws.Visible = xlVeryHidden
End Select
Next
ActiveSheet.Select
End Sub

Sub UnhideAll()
Call ToggleHideUnhideDataSheets("Show")

End Sub
 
Upvote 0
That sounds as though the workbook is protected.
 
Upvote 0
Solution
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,553
Messages
6,114,279
Members
448,562
Latest member
Flashbond

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