In this article, you will learn how to hide sheet automatically when the sheet is not in use.
Let us understand with an example:
Consider you are working on multiple worksheets (like Sales Report, Months, Raw Data, etc.) here you only need to unhide few (or single sheet) sheets when you are not using them.
Following is a snapshot of Sales Report; the workbook contains monthly data in each tab like Jan, Feb & so on.
The below snapshot shows the number of sheets this workbook contains
If you are preparing Sales Report & you do not want the Data tab to be invisible when it is not in use.
Click on Developer tab
From Code group select Visual Basic
or press ALT + F11 shortcut key to launch VB Editor screen.
Enter the following code in the Data (the sheet you want to auto hide)
Private Sub Worksheet_Deactivate()
ThisWorkbook.Sheets(“Data”).Visible = False
When you go to next tab, then Data sheet will automatically get invisible. Refer below shown snapshot
To unhide the Data sheet, you can right click on any sheet & click on Unhide
Select Data sheet & then click on OK button.
The Data sheet will get visible.
In this way, you can auto hide the sheets that you want to hide after using them.
The applications/code on this site are distributed as is and without warranties or liability. In no event shall the owner of the copyrights, or the authors of the applications/code be liable for any loss of profit, any problems or any damage resulting from the use or evaluation of the applications/code.