Excel VBA can unhide a hidden worksheet instantly—no manual right-clicking needed. This is especially useful when multiple sheets are hidden and you need to access one quickly, or when building automated workflows. You’ll need Excel installed (with Developer tab enabled for direct macro access), and the target workbook must be open.

What You'll Need

  • Microsoft Excel (2010 or later; most steps work identically across versions)
  • An open Excel workbook containing at least one hidden worksheet
  • Developer tab enabled (required only if writing macros manually; alternative via Immediate Window avoids this)

Step-by-Step

  1. Press Alt + F11 to open the Visual Basic for Applications (VBA) editor. This opens a separate window with the project explorer on the left (if hidden, press Ctrl + R to show it).
  2. In the Project Explorer, locate your workbook (e.g., VBAProject (YourFile.xlsx)), then expand the Microsoft Excel Objects folder. Right-click the hidden worksheet’s name (e.g., Sheet3 (HiddenData)) and choose View Code. If you prefer not to open the worksheet’s code window, skip to Step 5.
  3. Alternatively, to avoid opening the worksheet module, click Insert > Module in the VBA editor menu to create a generic code module.
  4. Enter one of these lines in the module (replace "Sheet2" with the actual sheet name or code name): Worksheets("Sheet2").Visible = True — This uses the visible tab name (what appears on the worksheet tab).
  5. Or, to use the sheet’s internal code name (e.g., Sheet2 as shown in the Project Explorer before any rename): Sheet2.Visible = True — This is more stable if the tab name changes later.
  6. Press F5 while the cursor is in the code line, or go to Run > Run Sub/UserForm to execute the command. The hidden worksheet will appear immediately in the workbook.
  7. Close the VBA editor by clicking the X or pressing Alt + Q. Your workbook now displays the previously hidden sheet.

Common Mistakes

  • Using the wrong sheet name: Typo in the name (e.g., "Sheet 2" with a space instead of "Sheet2") causes a runtime error. Always check the exact tab name or use the Project Explorer’s code name.
  • Assuming Visible = True works for xlVeryHidden sheets: If a sheet was hidden via VBA with xlVeryHidden (not the standard Hide option), True alone won’t unhide it. You must explicitly set Visible = xlSheetVisible (see Tips).
  • Running code against a closed workbook: VBA cannot modify a workbook that isn’t open. Ensure the file is open in Excel before executing code.
  • Ignoring sheet protection: If the workbook structure is protected, VBA code may fail to unhide sheets. Unprotect the workbook first (Review > Unprotect Workbook) or include password logic.

Tips

  • Use xlSheetVisible instead of True for clarity and compatibility: Worksheets("Sheet2").Visible = xlSheetVisible. This constant is equivalent to True but makes intent explicit and avoids ambiguity.
  • Unhide multiple sheets at once with a loop: Dim ws As Worksheet
    For Each ws In ThisWorkbook.Worksheets
      If ws.Visible = xlHidden Or ws.Visible = xlVeryHidden Then ws.Visible = xlSheetVisible
    Next ws
  • To unhide a sheet by its tab index (e.g., the third sheet), use Worksheets(3).Visible = xlSheetVisible, but note this is risky if sheet order changes.
  • For xlVeryHidden sheets, always use the constant: Worksheets("Secret").Visible = xlSheetVisible. xlVeryHidden can’t be unhidden manually via Excel’s UI—only through VBA or resetting the property.
  • Save the workbook as macro-enabled (.xlsm) if you plan to reuse the code later; otherwise, macros won’t persist.

Troubleshooting

If the worksheet doesn’t unhide or you get an error:

  1. Error 9: Subscript out of range — The sheet name is misspelled or doesn’t exist. Double-check the exact name in the Project Explorer or on the tab (right-click the tab bar > View Code to see the name in the Properties window).
  2. Error 1004: Unable to set Visible property of the Worksheet class — The workbook structure is protected. Go to Review > Unprotect Workbook (enter password if set), then rerun the macro.
  3. Sheet still hidden after running code — Confirm the sheet was truly xlHidden (standard hide), not xlVeryHidden. Use this diagnostic code in the Immediate Window (Ctrl + G in VBA editor): ?Worksheets("Sheet2").Visible. If it returns -2 (xlVeryHidden), use xlSheetVisible explicitly.
  4. No Developer tab visible — Enable it via File > Options > Customize Ribbon > check Developer. Alternatively, use the Immediate Window (Alt + F11 > Ctrl + G) and type Worksheets("Sheet2").Visible = xlSheetVisible, then press Enter.
  5. Macro security blocks execution — Go to File > Options > Trust Center > Trust Center Settings > Macro Settings, and select Enable all macros (temporarily for testing). Revert to Disable all macros with notification afterward for safety.

Frequently Asked Questions

Can I unhide a very hidden sheet without using VBA?

No. xlVeryHidden sheets are invisible in Excel’s standard UI—only VBA can unhide them by setting Visible = xlSheetVisible.

Does this work for protected worksheets (cell-level protection)?

Yes. Sheet protection (e.g., preventing edits) is separate from visibility. Unhiding a sheet doesn’t affect its protection status—you can still unlock cells or remove protection separately.

Will unhidden sheets retain their data and formatting?

Absolutely. Unhiding only changes visibility; all data, charts, formulas, and formatting remain intact.

Can I unhide all hidden sheets at once with one command?

Yes. Use the loop in the Tips section: iterate through all worksheets and set Visible = xlSheetVisible for those that are hidden or very hidden.

What if I forget the sheet name?

In the VBA editor’s Project Explorer, expand the workbook’s Microsoft Excel Objects folder. The sheet’s code name (e.g., Sheet3) appears first, followed by its tab name in parentheses (e.g., Sheet3 (Data)). Use either name in your code—code names are safer.

Is there a keyboard shortcut to unhide a sheet manually (no VBA)?

Yes: Press Alt > H > O > U > I (in Excel for Windows). This opens the Unhide dialog. Select the sheet and click OK. On Mac, use Command + Option + U (if the sheet is standard-hidden, not very hidden).