How to Unhide All Sheets in Excel at Once Using VBA (One Click)

Written by

in

When working with complex financial models or inherited client workbooks, you often encounter multiple hidden or ‘very hidden’ worksheets. Unhiding them manually in Excel requires right-clicking and selecting each tab individually, which becomes tedious when dealing with dozens of sheets.

In this guide, you will learn how to use a simple 5-line Excel VBA macro to instantly unhide all hidden and very hidden worksheets in your workbook with a single click.


Why Use VBA to Unhide Worksheets?

Standard Excel UI limitations make bulk worksheet management inefficient. Automating this step provides key benefits:

  • Instant Batch Execution: Unhide 5, 20, or 100+ sheets in less than a second.
  • Unhide ‘Very Hidden’ Sheets: Reveals sheets set to xlSheetVeryHidden that do not even appear in the standard Excel Unhide dialog box.
  • Time Savings: Eliminates repetitive right-click clicks during workbook auditing and reviews.

Step 1: Open the Visual Basic Editor

  1. Open the Excel workbook containing the hidden sheets.
  2. Press Alt + F11 (Option + F11 on Mac) to launch the VBA Editor.
  3. In the top menu, click Insert ➔ Module to open a new code window.

Step 2: Copy and Paste the Unhide VBA Code

Copy the code block below and paste it directly into your module window:

Sub UnhideAllWorksheets()
    Dim ws As Worksheet
    Dim unhiddenCount As Long
    
    unhiddenCount = 0
    
    ' Pause screen updating for faster execution
    Application.ScreenUpdating = False
    
    ' Loop through every sheet in the workbook
    For Each ws In ActiveWorkbook.Worksheets
        If ws.Visible <> xlSheetVisible Then
            ws.Visible = xlSheetVisible
            unhiddenCount = unhiddenCount + 1
        End If
    Next ws
    
    Application.ScreenUpdating = True
    
    ' Completion notification
    If unhiddenCount > 0 Then
        MsgBox unhiddenCount & " hidden sheet(s) have been successfully unhidden!", vbInformation, "Excel Owl Automation"
    Else
        MsgBox "No hidden sheets were found in this workbook.", vbInformation, "Excel Owl Automation"
    End If
End Sub

Step 3: Run the Macro Using Alt + F8

Trigger the script directly from your Excel window:

  1. Switch back to your main Excel window.
  2. Press Alt + F8 (or Option + F8 on Mac) to open the Macro dialog.
  3. Select UnhideAllWorksheets and click Run. All hidden tabs will immediately appear!

💡 Pro Tip: Need to Hide All Sheets Again?
To do the reverse and hide all sheets except the active one, simply change ws.Visible = xlSheetVisible to ws.Visible = xlSheetHidden inside a conditional check!


Step 4: Save as Macro-Enabled Workbook (.xlsm)

If you plan to reuse this macro inside this workbook in the future, save your file via File ➔ Save As and select Excel Macro-Enabled Workbook (*.xlsm).

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *