2 Ways to Hide Worksheets in Excel (Not Easily Found)
2 Ways to Hide Worksheets in Excel (Not Easily Found). You can hide any worksheet to remove it from view. However, if you want to keep certain worksheets hidden from others who access your file, there are two ways to do so. Let’s explore these methods together!
Hide worksheets through the Power Query property
To hide a worksheet, first right-click on the sheet you want to hide, then select View Code.
Next, in the Power Query interface, select the name of the sheet you want to hide and move to the Properties Window (F4) on the toolbar.
This will display a table of properties for the sheet you want to hide. Under Visible, select 2 – XlSheetVeryHidden.
That’s it! The worksheet is now hidden. To unhide the worksheet, right-click on any sheet, select Properties from the toolbar, and select -1 – xlSheetVisible.
Hide worksheets by writing macros in Excel
This method allows you to hide multiple sheets at once while keeping the selected sheet visible without anyone noticing, except for those who know this trick!
Here are the steps to follow:
Step 1: Right-click on the sheet you want to keep visible and select View Code.
Step 2: In the Power Query interface, select the name of the sheet you want to keep visible, right-click, and select Insert => Module.
Step 3: Type the following code to hide the sheets:
Sub HideSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If ws.Name <> ActiveSheet.Name Then ws.Visible = xlSheetVeryHidden
Next ws
End Sub
Step 4: On the toolbar, click Run to run the code and see the results!
If you want to unhide the hidden worksheets, go back to the Power Query interface and select the module where you inserted the code to hide the sheets. Type the following code to unhide the sheets:
Sub UnHideSheets()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets ws.
Visible = xlSheetVisible
Next ws
End Sub
Finally, click Run to see the results!
That’s it! I hope this article was helpful to you. If you found it useful, please don’t forget to rate the article below. Thank you for choosing buffcom!