unable to set the visible property of the worksheet class

Aleciafxc

Board Regular
Joined
Mar 21, 2009
Messages
77
Various sheets are hidden and made visible through macros. Every once in a while sheets will be hidden and i cannot get them unhidden. When I right click on a sheet name the hide, unhide options are grayed out.

I have tried

Sub UnHideSheets()
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets

ws.Visible = xlSheetVisible
Next ws
End Sub

This does not work. When I attempt to access the sheet in the Developer and set its property to xlsheetvisable this error comes up

unable to set the visible property of the worksheet class

any help would be appreciated.

thanks
Alecia :(
 
It works... Am Happy.. Thank u..

Sorry, I don't have any other suggestions. The error you get and the hide/unhide options for each sheet being greyed out both happen when the workbook structure is protected. I can't think of a different cause based on the information on the thread. I assume this is not an issue for all workbooks.

I know you've said that the workbook protection is not the problem, but just to be sure what happens if you run this code?
Code:
Sub UnHideSheets()
    Dim ws As Worksheet
    
    ActiveWorkbook.Unprotect "aaa"
    
    For Each ws In ActiveWorkbook.Worksheets
    
        ws.Visible = xlSheetVisible
    Next ws
    
End Sub
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Sorry, I don't have any other suggestions. The error you get and the hide/unhide options for each sheet being greyed out both happen when the workbook structure is protected. I can't think of a different cause based on the information on the thread. I assume this is not an issue for all workbooks.

I know you've said that the workbook protection is not the problem, but just to be sure what happens if you run this code?
Code:
Sub UnHideSheets()
    Dim ws As Worksheet
   
    ActiveWorkbook.Unprotect "aaa"
   
    For Each ws In ActiveWorkbook.Worksheets
   
        ws.Visible = xlSheetVisible
    Next ws
   
End Sub


I made an account just to thank you. You saved my life.
 
Upvote 0
Please Unprotect Workbook with Unprotect Structure & windows....(If you have protected)
Please see image
Then problem will be automatically resolved.
I have personally checked & verified this situation.
 

Attachments

  • Sheet Hide-Unhide Problem.png
    Sheet Hide-Unhide Problem.png
    100.6 KB · Views: 227
Upvote 0
SharePoint involving 2 people working on the same excel workbook can lead to corruption of the workbook.
That gave me that error message when I was running VBA code.
I rolled back, using SharePoint version history, to a good copy.
 
Upvote 0

Forum statistics

Threads
1,214,985
Messages
6,122,605
Members
449,089
Latest member
Motoracer88

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