Open and Automatically Hide a Worksheet in Excel
Question details
Open hidden worksheets from a summary sheet and automatically hide them when users leave or close the workbook.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- A summary sheet provides access to worksheets that should otherwise remain hidden.
- Observed behavior
- Users should be able to open a hidden worksheet and have it hidden again after leaving it or closing the workbook.
Use desktop Excel, save the workbook as an Excel Macro-Enabled Workbook (.xlsm), and enable macros when prompted. Keep the summary sheet visible and make sure the workbook structure is not protected against changes to sheet visibility.
Use VBA to open and automatically hide a worksheet
Use a macro-enabled shape on the summary sheet to open the hidden worksheet, then use worksheet and workbook events to hide it again.
A normal hyperlink cannot unhide a hidden worksheet before navigating to it. A shape assigned to a macro provides a clickable alternative.
The example uses sheets named Summary and Sheet2. Replace these names with the exact worksheet tab names in your workbook.
Open the Visual Basic Editor from Developer > Visual Basic. Select your workbook, choose Insert > Module, and add: Sub OpenSheet2() With ThisWorkbook.Worksheets("Sheet2") .Visible = xlSheetVisible .Activate End With End Sub
On the Summary sheet, choose Insert > Shapes and add a shape labeled for Sheet2. Right-click the shape, choose Assign Macro, select OpenSheet2, and click OK.
In the Visual Basic Editor, double-click Sheet2 under Microsoft Excel Objects and add: Private Sub Worksheet_Deactivate() Me.Visible = xlSheetHidden End Sub
Double-click ThisWorkbook under Microsoft Excel Objects and add: Private Sub Workbook_BeforeClose(Cancel As Boolean) ThisWorkbook.Worksheets("Summary").Activate ThisWorkbook.Worksheets("Sheet2").Visible = xlSheetHidden End Sub
Return to Excel, click the shape on Summary, and verify that Sheet2 opens. Select Summary to confirm that Sheet2 hides, then save the workbook; when closing, save any prompted changes to retain the hidden state.

Manage spreadsheets with WPS Office
WPS Office is a free, lightweight alternative with a familiar spreadsheet interface and support for common Excel formats, making it easy to move everyday workbook work. The Excel VBA event solution above is specific to Microsoft Excel.

Frequently Asked Questions
Can an Excel hyperlink open a hidden worksheet directly?
A normal hyperlink does not unhide a worksheet before navigating to it. Instead, insert a shape on the summary sheet and use right-click > Assign Macro to run a macro that makes the sheet visible and activates it.
Where should I put the Worksheet_Deactivate code?
In Developer > Visual Basic, double-click the target worksheet under Microsoft Excel Objects and paste the event procedure into that worksheet's code module.
Why does Excel not hide the worksheet when I leave it?
Check that macros are enabled, the Worksheet_Deactivate code is in the correct worksheet module, and workbook structure protection is not preventing visibility changes. Also keep another worksheet visible.
Will the sheet remain hidden after I close the workbook?
The Workbook_BeforeClose event can hide it, but the hidden state must be saved. If Excel prompts you to save changes when closing, choose Save.




