In the last few days I’ve been asked a few questions by work colleagues regarding the visibility of sheets:
- This cell references a sheet, why I can’t find the sheet?
- Is it possible to unhide multiple sheets at the same time?
So, let’s take a look the process of hiding, unhiding and making sheets invisible.
Basic hiding and unhiding sheets:
You are probably familiar with the process of hiding and unhiding sheets.
Right-click the tab at the bottom and select “Hide” to hide a sheet.
To unhide right click on a worksheet tab at the bottom, select Unhide from the menu. A list of hidden sheets will appear, click the sheet you wish to unhide, then click OK.
Or you could go through the ribbon:
Home -> Cells -> Format -> Hide & Unhide -> Unhide Sheet
Applying to multiple sheets
If you want to hide multiple sheets you can use Shift or Ctrl to select a range of sheets or specific sheets. Then right-click on one of the selected tabs and select Hide.
However, unhiding multiple sheets isn’t so easy. In fact, there isn’t a method in Excel to do it. So that means you have to go through one by one, or you can use a little bit of VBA.
Insert the following code into the Visual Basic Editor
Sub AllSheetsVisible() 'Create a variable to hold the worksheet Dim Ws As Worksheet 'Loop through each worksheet in the Worksheets collection of the 'active workbook and set it to visible For Each Ws In ActiveWorkbook.Worksheets Ws.Visible = xlSheetVisible Next Ws End Sub
If you wanted to adapt the code to hide worksheets you could replace the following code. As there must be at least one visible worksheet, there is an Error Handler, so that the last visible sheet will not be hidden.
Sub AllSheetsHidden() 'This code does not actually hide all sheets, as there must be 'at least one visible sheet. The code will hide all except the last sheet. 'Create a variable to hold the worksheet Dim Ws As Worksheet 'Loop through each worksheet in the Worksheets collection of the 'active workbook and set it to visible. For Each Ws In ActiveWorkbook.Worksheets 'If there is an error do not hide the sheet On Error Resume Next Ws.Visible = xlSheetHidden On Error Goto 0 Next Ws End Sub
It is possible to have sheets which are neither visible nor hidden, these sheets are invisible (or “very hidden” as Excel calls it). This is the reason my colleague had a formula reference to a sheet which they couldn’t find, the sheet was invisible.
Worksheets in Excel can have 3 states of visibility: Visible, Hidden and Very Hidden.
- Visible = You can see the worksheet
- Hidden = You can’t see the worksheet, but it is listed as a hidden workbook
- Very Hidden = You can’t see the worksheet and it is not listed as a hidden workbook (i.e. it is “invisible”, unless you use VBA or the VBA Editor)
To make a sheet Invisible use you can replace this line of code:
Ws.Visible = xlSheetHidden
With this one:
Ws.Visible = xlSheetVeryHidden
Changing the status of a single sheet
If you know the names of your worksheets you can change their visibility status by using their individual sheet names in the VBA code.
Sub ChangeSheetVisiblity Activeworkbook.Sheets(“[Insert Sheet Name]”).Visible = xlVeryHidden End Sub
Get our FREE VBA eBook of the 30 most useful Excel VBA macros.
Automate Excel so that you can save time and stop doing the jobs a trained monkey could do.
If you’ve found this post useful, or if you have a better approach, then please leave a comment below.
Do you need help adapting this to your needs?
I’m guessing the examples in this post didn’t exactly meet your situation. We all use Excel differently, so it’s impossible to write a post that will meet everybody’s needs. By taking the time to understand the techniques and principles in this post (and elsewhere on this site) you should be able to adapt it to your needs.
But, if you’re still struggling you should:
- Read other blogs, or watch YouTube videos on the same topic. You will benefit much more by discovering your own solutions.
- Ask the ‘Excel Ninja’ in your office. It’s amazing what things other people know.
- Ask a question in a forum like Mr Excel, or the Microsoft Answers Community. Remember, the people on these forums are generally giving their time for free. So take care to craft your question, make sure it’s clear and concise. List all the things you’ve tried, and provide screenshots, code segments and example workbooks.
- Use Excel Rescue, who are my consultancy partner. They help by providing solutions to smaller Excel problems.
Don’t go yet, there is plenty more to learn on Excel Off The Grid. Check out the latest posts: