Fix Cannot Set Excel Worksheet to xlSheetVisible in VBA
Question details
The user is unable to change an Excel worksheet's visibility status from xlSheetVeryHidden to xlSheetVisible using VBA.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to unhide a Very Hidden worksheet using the Visual Basic Editor or VBA code.
- Observed behavior
- Excel VBA refuses to update the worksheet's visibility property to xlSheetVisible, often producing an error or failing silently.
Before modifying VBA properties or removing workbook protections, ensure you have saved a backup copy of your macro-enabled workbook to prevent accidental data loss.
Disable Workbook Structure Protection
The most common reason a very hidden sheet cannot be made visible is that the workbook's structure is protected, which locks visibility settings.
Workbook protection prevents users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets. When active, VBA scripts will also be blocked from altering the visibility status of any worksheet, especially those set to xlSheetVeryHidden.
Open the affected workbook and navigate to the 'Review' tab on the main ribbon.
Look for the 'Protect Workbook' button. If the button appears highlighted or pressed in, workbook structure protection is currently active.
Click 'Protect Workbook' to toggle it off. You may be prompted to enter a password if the workbook's structure was secured with one.
Return to the VBA Editor (Alt + F11), select your specific worksheet in the Project Explorer, and try changing the Visible property to xlSheetVisible again.
Troubleshoot Odd Workbook States
If the workbook is definitely unprotected and the sheet still refuses to become visible, the file may be corrupted or stuck in an irregular state.
Manage Hidden Worksheets and VBA Seamlessly with WPS Office
WPS Spreadsheet provides robust support for VBA macros and workbook protection. It allows you to easily manage xlSheetVeryHidden properties and debug macro codes in a lightweight, stable environment.
- 1. Open your Workbook: Launch WPS Spreadsheet and open your macro-enabled workbook.
- 2. Check Protection: Navigate to the 'Review' tab to easily verify and disable 'Protect Workbook' if it is highlighted.
- 3. Access VBA Editor: Go to the 'Developer' tab and click on 'Visual Basic' to open the built-in VBA Editor.
- 4. Change Visibility: Select the target sheet in the properties window and successfully set its visibility to xlSheetVisible.

Frequently Asked Questions
What is the difference between xlSheetHidden and xlSheetVeryHidden?
xlSheetHidden hides the sheet from the standard tab view, but users can easily unhide it using the regular right-click menu in the spreadsheet interface. xlSheetVeryHidden completely hides the sheet so that it does not appear in the unhide dialog box; it can only be made visible again via VBA code or the VBA Properties window.
Does worksheet-level protection prevent me from unhiding sheets?
No. Worksheet protection only locks the contents, cells, and formatting of that specific sheet. To unhide or hide sheets, you must check the Workbook protection, which manages the overall structure of the file.
Why is my 'Protect Workbook' button grayed out?
This usually happens if multiple worksheets are currently grouped, or if the workbook is set to 'Shared' mode. Right-click any sheet tab and select 'Ungroup Sheets', or turn off legacy workbook sharing to regain access to the protection settings.
Can a sheet be locked in the xlSheetVeryHidden state permanently?
Normally, no. However, if the workbook structure was protected with a password that is now lost, or if the file structure has become severely corrupted, you may be locked out of changing the visibility. Re-creating the file or restoring from a backup is the safest solution.




