In case you prefer reading a tutorial over watching a video, below is a detailed written tutorial on unhiding sheets in Excel.
When you work with data that is spread across multiple worksheets in Excel, you may want to hide a few worksheets. This could be to avoid the clutter or to not show some data to your client/manager by hiding some worksheets and only keeping the useful ones visible.
And in some cases, you may have a workbook that has some hidden sheets and you want to unhide some or all of these worksheets.
In this tutorial, I will show you some methods to unhide worksheets in Excel (manually as well as automatically using VBA). I will also show you how to selectively unhide worksheets based on the name or a condition.
So let’s get started!
Unhiding Sheets Manually
If you only have a few worksheets that are hidden, you can manually unhide some or all of these worksheets.
Suppose you have an Excel workbook that has 10 worksheets that are hidden.
Below are the steps to manually unhide worksheets (one at a time):
1. Right-click on any of the existing worksheet tab
2. Click on the Unhide option. This will open the Unhide dialog box that lists all the hidden worksheets
3. In the Unhide dialog box, click on the worksheet that you to unhide (you can only select one at a time).
4. Click OK.
The above steps would unhide the select worksheet.
Note: Unfortunately, there is no in-built functionality in Excel to quickly unhide all the hidden worksheets (or a way to select more than one worksheet and unhide it). As of now, you need to use the unhide dialog box where you can only select one worksheet to unhide.
You can hide worksheets in bulk, but not unhide in bulk
If you want to hide worksheets, you can select multiple worksheets at once (hold the control key and click on the worksheet tab name), right-click and click on the Hide option.
Unfortunately, there is no in-built functionality in Excel to quickly unhide all the hidden worksheets (or a way to select more than one worksheet and unhide it). As of now, you need to use the unhide dialog box where you can only select one worksheet to unhide.
While there is no-inbuilt functionality to unhide in bulk, you can easily do this with a simple VBA macro code.
Unhide All Sheets At One Go
With VBA, you can easily unhide worksheets in bulk.
For example, if you have 10 hidden worksheets, you can create a simple VBA code to unhide all the worksheets or you can unhide based on a condition (such as unhide only those where there is a specific prefix or year in the name).
Note: The methods covered in this tutorial doesn’t require you to save an Excel workbook in a macro-enabled format (.XLSM) to use the VBA code.
Using Immediate Window
VB Editor in Excel has an immediate window where you can type a line of code and instantly execute it right away.
Below are the steps to use this above line of code to unhide sheets through immediate window:
1. Right-click on any of the visible sheets in the workbook
2. Click on View code. This will open the VB Editor.
3. Click the View option in the menu and then click on the Immediate window. This will make the Immediate window appear in the VB Editor (if not there already).
4. In the Immediate window, copy and paste the following line of code: For each Sheet in Thisworkbook.Sheets: Sheet.Visible=True: Next Sheet
5. Place the cursor at the end of the line
6. Hit the Enter key
That’s it!
The above steps would instantly unhide all the sheets in the workbook.
Once done, you can close the VB Editor.
The best part about this is that you can do this on any workbook. You don’t need to worry about saving the workbook in a macro-enabled format. Just execute a line of code and instantly unhide all the sheets in the workbook.
Let me also quickly explain the below VBA code that we have used in the immediate window to unhide sheets:
For each Sheet in Thisworkbook.Sheets: Sheet.Visible=True: Next Sheet
The above code uses a For Next VBA loop to go through all the sheets in the workbook and set the visible property to TRUE. Once the visible property of all the sheets is changed, the code will end.
The colon (:) used in the code above is equivalent to a line break. While it looks like a single line of code, it has three parts to it which are separated by two colons.
If you’re interested in learning more about the immediate window and some awesome things you can do with it, here is a detailed tutorial about it.
By Adding Macro to QAT (with One Click)
In case you have to unhide worksheets quite often, another good way could be to have the macro code to unhide sheets in the Personal macro workbook and save the icon in the Quick Access Toolbar.
This is just a one time process and once you have it done, you can then unhide sheets in any workbook by simply clicking on a button in the QAT.
This is by far the most efficient way to unhide sheets in Excel (most useful when you get a lot of workbooks with hidden sheets and you have to unhide these).
The trick here is to save the code to unhide sheets in the Personal Macro Workbook.
A Personal Macro Workbook is something that is always open when you open any Excel file (you can’t see it though). When you save a macro code to the Personal Macro workbook, this code is now always available to you. And when you add this to the QAT and you run the macro code with a single click.
Below is the code that you need to add to the Personal Macro Workbook:
Sub UnhideAllSheets() For Each Sheet In Sheets Sheet.Visible = True Next Sheet End Sub
Below are the steps to add this code to the Personal Macro Workbook:
1. Click on the record macro button (it’s at the bottom left of the Excel workbook application)
2. In the Record Macro dialog box, change the Store macro in setting to – Personal Macro Workbook.
3. Click OK. This will start recording the macro
4. Click on the Stop macro recording icon (at the bottom left of the workbook). This will stop the macro recording
5. Right-click on any sheet tab and then click on ‘View Code’
6. In the VB Editor, double-click on the Module object in the Personal.XLSB workbook
7. Remove any existing code and copy and paste the above code.
8. Click the Save icon in the toolbar
9. Close the Vb Editor
The above steps allow you to make the Personal Macro Workbook visible in the VB Editor and place the code to unhide sheets in it.
Now all you need to do is add this code to the Quick Access Toolbar so that you can use it anytime from any workbook.
Below are the steps to add this code to the Quick Access Toolbar:
10. Click on the Customize Quick Access Toolbar icon.
11. Click on More Commands.