logo
search
VBA & Macro Problems

Fix Cannot Set Excel Worksheet to xlSheetVisible in VBA

Camila MilosovichCamila Milosovich Sep 28, 2026 870 views

Question details

The user is unable to change an Excel worksheet's visibility status from xlSheetVeryHidden to xlSheetVisible using VBA.

How to Fix "Cannot Set Worksheet to xlSheetVisible" in Excel 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 you start

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.

Solution 1Recommended

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.

1
Check Review Tab

Open the affected workbook and navigate to the 'Review' tab on the main ribbon.

2
Identify Protection Status

Look for the 'Protect Workbook' button. If the button appears highlighted or pressed in, workbook structure protection is currently active.

3
Unprotect the Workbook

Click 'Protect Workbook' to toggle it off. You may be prompted to enter a password if the workbook's structure was secured with one.

4
Update VBA Property

Return to the VBA Editor (Alt + F11), select your specific worksheet in the Project Explorer, and try changing the Visible property to xlSheetVisible again.

Worksheet vs. Workbook Protection: Individual worksheet protection does not prevent unhiding sheets. Only workbook-level protection restricts structural changes like modifying sheet visibility.
Advanced Spreadsheet Management

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. 1. Open your Workbook: Launch WPS Spreadsheet and open your macro-enabled workbook.
  2. 2. Check Protection: Navigate to the 'Review' tab to easily verify and disable 'Protect Workbook' if it is highlighted.
  3. 3. Access VBA Editor: Go to the 'Developer' tab and click on 'Visual Basic' to open the built-in VBA Editor.
  4. 4. Change Visibility: Select the target sheet in the properties window and successfully set its visibility to xlSheetVisible.
Full compatibility with Microsoft Excel macro formats (.xlsm, .xls)Built-in robust VBA Editor for executing and debugging macrosIntuitive Review tab for clear management of workbook and worksheet protectionFree, lightweight application that minimizes file corruption risks
microsoft office alternative - wps office

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.