I have an Excel workbook that has three tabs. Two of which are hidden. When I try an unhide the hidden worksheets worksheets the unhide option is greyed out. I have opened the project window in VBA IDE and can see that the Visible options are set to 0- xlSheetHidden
for the two sheets. I have tried to change the visibility here to -1 -xlSheetVisable
but I get the error:
Unable to set the Visibility property of the Worksheet Class.
I have also tied to unhide the sheets with the following code:
Sub UnhideAllSheets()
'Unhide all sheets in workbook.
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
End Sub
But I get the error:
Run-time 'Visible of object'_Worksheet' failed
The worksheets do exist and there are no passwords or any protection anywhere in the workbook.
For Each ws In ThisWorkbook.Sheets If ws.Visible = xlSheetHidden Then ws.Unprotect
to check if the hidden sheets are protected – JLCHAlt - T - P - W
to check – Siddharth Rout