Unhide Worksheet in Excel VBA: Methods, Code, and Fixes

VBA & macros · Updated November 21, 2026

To unhide a worksheet with VBA, set its Visible property to xlSheetVisible. You can reveal one named sheet or loop through every worksheet in a workbook; the examples below show both approaches and explain what to check if Excel blocks the change.

What “unhide” means in Excel

A hidden worksheet still exists in the workbook, but its tab is not displayed. Excel has two hidden states for a worksheet: xlSheetHidden, which can also be reversed through Excel’s normal Unhide command, and xlSheetVeryHidden, which cannot be selected in that dialog. VBA can set either kind of hidden worksheet to xlSheetVisible.

Unhiding changes visibility; it does not restore deleted data or remove a password. It also does not change the worksheet’s contents, formulas, or position. If a sheet is missing from the tabs, it may simply be hidden, but there are other possibilities: the sheet tabs may be turned off, the workbook may be in a different window, or the sheet may have been deleted.

VBA code to unhide every worksheet

To make every worksheet visible in the workbook that is currently active, use a loop. This works for sheets hidden through Excel’s Unhide command and for sheets set to VeryHidden.

Sub UnhideAllWorksheets()
    Dim ws As Worksheet

    ' Make each worksheet in the active workbook visible.
    For Each ws In ActiveWorkbook.Worksheets
        ws.Visible = xlSheetVisible
    Next ws
End Sub

Activate the workbook you intend to change before running this macro. ActiveWorkbook means the workbook currently active in Excel, which may not be the workbook containing the macro—for example, if the code is stored in Personal.xlsb. If you want the macro to act on the workbook where its code is stored, replace ActiveWorkbook with ThisWorkbook.

The loop covers worksheets, not chart sheets. A chart sheet is a separate kind of sheet object, so this code does not change its visibility. Excel also requires at least one visible sheet in a workbook; trying to hide the only visible sheet is not allowed.

VBA code to unhide one named worksheet

If you know the sheet’s tab name, reveal just that worksheet instead of changing every sheet. In this example, replace Summary with the exact tab name, including spaces and punctuation.

Sub UnhideSummaryWorksheet()
    Dim ws As Worksheet

    ' Refer to the worksheet by its tab name.
    Set ws = ActiveWorkbook.Worksheets("Summary")
    ws.Visible = xlSheetVisible
End Sub

This approach is useful when a workbook contains intentionally hidden helper sheets that should remain hidden. If the name is misspelled or the sheet does not exist in the active workbook, VBA will return an error. Confirm the workbook and tab name before running the macro. You can also use a worksheet’s VBA code name, but the tab name is usually easier to identify and is what the example uses.

How to add and run the macro

In Excel for Microsoft 365 on Windows, open the workbook and press Alt+F11 to open the Visual Basic Editor. In the editor, choose Insert > Module, paste the code into the new module, and return to Excel. To run it from Excel, choose Developer > Macros, select the macro, and click Run. You can also run a selected procedure from the Visual Basic Editor with F5.

If the Developer tab is not visible in Windows, use File > Options > Customize Ribbon, select Developer, and choose OK. On a Mac, open the Visual Basic Editor from the Developer tab; the keyboard shortcut is often Option+F11, though some keyboards require holding Fn as well. If Developer is not shown, enable it in Excel’s ribbon settings. The exact settings label can vary slightly by Mac release.

Excel for the web does not run VBA macros. Open the workbook in the desktop Excel app to use this code. A workbook saved as an .xlsx file cannot retain VBA code; save a macro-containing workbook as .xlsm (or another macro-enabled format) if you need to keep the macro.

VeryHidden sheets and the regular Unhide command

For a sheet hidden in the ordinary way, you may not need VBA. Right-click a visible sheet tab and choose Unhide, select the sheet, and confirm. In desktop Excel for Windows, you can also use Home > Format > Hide & Unhide > Unhide Sheet. Excel’s dialog reveals one worksheet at a time.

A VeryHidden sheet is different: it does not appear in the standard Unhide dialog. VBA can reveal it by setting its visibility to xlSheetVisible. You can also inspect or change the property in the Visual Basic Editor’s Properties window, but a macro is more convenient when there are many sheets or the same task must be repeated.

VeryHidden is a visibility setting, not encryption or strong data protection. Someone with access to the workbook and its VBA project may be able to change the setting. Do not use hidden sheets as the sole way to protect confidential information.

Common problems and how to diagnose them

  • The macro reports an error about changing the Visible property. The workbook structure may be protected. Check Review > Protect Workbook. If structure protection is active, ask the workbook owner for the password or authorization to unprotect it; VBA is not a legitimate way to bypass that protection.
  • The sheet name cannot be found. Verify that the intended workbook is active and that the spelling matches the worksheet tab name. A sheet in another open workbook is not part of the workbook referenced by ActiveWorkbook.
  • The macro does not run. Check whether Excel has blocked macros, whether the file is open in desktop Excel, and whether the code is in a standard module. Only enable macros for files you trust, and follow your organization’s security policy.
  • No tabs are visible at all. The sheet tabs display setting may be off rather than every sheet being hidden. In Windows, check File > Options > Advanced > Display options for this workbook and make sure Show sheet tabs is selected. Mac settings are under Excel’s Settings or Preferences, in the View options.
  • The Unhide command is unavailable or the sheet is not listed. The workbook may have only one visible sheet, structure protection may be enabled, or the target may be VeryHidden. Try the visibility macro only when you have permission and the workbook structure allows the change.

Safety, saving, and choosing the right method

Before running a macro, save a separate copy of the workbook. VBA changes cannot be undone with Ctrl+Z (or the Mac undo shortcut), so a backup is the safest way to preserve the original state. After running the code, check the tabs and save the workbook if you want the new visibility settings to persist.

Use the regular Unhide command when you have one or a few ordinarily hidden sheets and want to choose them individually. Use the one-sheet macro when you know the target name, and use the loop when you deliberately want every worksheet visible. If the workbook is protected or you are unsure why a sheet was hidden, ask its owner before changing it. Hidden sheets sometimes contain calculations, staging data, or workflow controls that other parts of the workbook rely on.

For recurring tasks, keep a clearly named macro in the workbook and document which sheets it changes. If you are distributing the file, consider whether recipients need the code and whether they should be able to view the helper sheets. A macro that reveals everything can expose internal working sheets as well as the sheet a user is looking for.

Frequently Asked Questions

Can VBA unhide a VeryHidden worksheet?
Yes. Set that worksheet’s Visible property to xlSheetVisible. A VeryHidden sheet is excluded from Excel’s normal Unhide dialog, but it is still a worksheet in the workbook.

Can I unhide all sheets at once without VBA?
Excel’s standard Unhide dialog reveals sheets one at a time. For many ordinarily hidden worksheets, a VBA loop can set every worksheet to visible in one run. VeryHidden sheets also require VBA or a change through the Visual Basic Editor.

Why does Excel say the Visible property cannot be changed?
A common cause is workbook structure protection. If it is protected, get permission and the password from the workbook owner before changing sheet visibility. Also confirm that the workbook is not in a restricted state that prevents structural edits.

Does unhiding a worksheet remove its password?
No. Visibility and worksheet protection are separate settings. Making a sheet visible does not remove protection from locked cells or change the sheet’s protection password.

Will this macro work in Excel for the web?
No. Excel for the web does not execute VBA. Open the workbook in desktop Excel to run the macro; web Excel can handle some ordinary sheet visibility tasks through its interface, but not VBA execution.

Will saving as XLSX keep the macro?
No. The .xlsx format does not store VBA code. Use a macro-enabled format such as .xlsm to retain the macro, and save a copy before making changes.

Related

Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.

More in VBA & macros

Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources

Spotted an error in this guide? Let us know.