Professional Documents
Culture Documents
Blog Resources
Bottom line: Learn a few di erent ways to unhide (show) multiple sheets at the same time
with a VBA macro or add-in.
Skill Level:Intermediate
This can make the process of unhiding multiple sheets very time consuming, especially if you
want to unhide all the sheets in the workbook. So in this article we will look at a few
di erent ways to quickly make sheets visible.
You can run this code in the VB Editors Immediate Window in three easy steps:
That line of code loops through all the worksheets in the workbook and sets each sheets
visible property to True. This makes each sheet visible, which is the same as unhiding each
sheet.
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 2/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
The colon character : used in the code allows you to basically combine multiple lines of
code into one line. This makes it possible to run in the Immediate Window because the
Immediate Window only evaluates one line of code at a time.
Checkout my article on 5 Ways to Use the VBA Immediate Window to learn more. And a big
thanks to Jan Karel Pieterse ofwww.jkp-ads.comforsharing this trick in the comments
section.
The macro below is basically that same line of code, but it is broken up into multiple lines.
This makes it much easier to read and understand.
Sub Unhide_Multiple_Sheets()
Dim ws As Worksheet
ws.Visible = xlSheetVisible
Next ws
End Sub
The lines in the code above that start with For and Next represent a For-Next Loop
Statement. The rstline For Each ws In ActiveWorkbook.Worksheets tells the macro to
loop through each worksheet in the worksheets collection of the workbook.
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 3/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
That line also references the variable ws and sets it to represent the worksheet object.
This means that ws temporarily represents the current worksheet in the loop.
When the Next ws line of code is hit, the macro jumps back up to the rst line of code
within the loop and evaluates it again. It continues to loop through all the sheets in the
workbooks worksheet collection (Activeworkbook.Worksheets).
We can then use ws inside the loop to change the current worksheets properties. In this
case we are setting the Visible property of the sheet to be visible (xlSheetVisible). The
visible property has three di erent properties to choose from:
xlSheetHidden
xlSheetVeryHidden
xlSheetVisible
You can also set the property to True, which works the same as xlSheetVisible.
Here is the documentation on the VBA Visible property from Microsoft. And checkout my
article on the For Next Loop for a detailed explanation of how it works.
We can add a simple IF statement to the macro to only unhide sheets that contain a speci c
name or text.
Sub Unhide_Sheets_Containing()
Dim ws As Worksheet
End Sub
The InStr function searches for text in a string and returns the position of the rst
occurrence of the text. It is short for InString, and the function is similar to the SEARCH or
FIND functions in Excel.
So in this case we are looking for any sheet that contains the word pivot in the sheet name.
The ws.name reference returns the name of the worksheet that is currently being
evaluated in the For-Next loop.
So this line If InStr(ws.Name, pivot) > 0 Then basically says, if the word pivot is found in
the sheet name then the Instr function will return a number greater than zero. The IF
statement will evaluate to True and the next line of code will be run to unhide the sheet.
If the word pivot is NOT found in the sheet name, then the IF statement will evaluate to
False and the code will skip all lines until it gets to the End If line. Therefore, the sheet that
is currently being evaluated in the loop will keep its current visible property (visible or
hidden).
This macro works great if you are hiding and unhiding sheets every day/week/month for a
report that you maintain. Run the macro to unhide speci c sheets when you open the
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 5/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
workbook. After you are nished, run the same codebut change the visible property to
xlSheetHidden to re-hide the sheets (you can create a new macro for this).
The Tab Hound window contains a list of all the sheets in the workbook. You can select
multiple sheets in the list, then press the Unhide button to unhide all the selected sheets.
Tab Hound also contains additional ways to lter the sheet list. You can type a search in the
search box, lter for all visible or hidden tabs, and even lter by tab color. This makes it easy
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 6/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
to nd the sheets you are looking for and then perform actions on them like
hiding/unhiding.
This video also shows how to quickly hide and unhide multiple sheets with Tab Hound.
We need to update a workbook with new data this week and make some changes before
emailing it out. Those updates require us to unhide a few sheets, make the changes, then
hide the sheets again. It can be a time consuming process if you have to hide/unhide a lot of
sheets.
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 7/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
Tab Control will setup a control sheet in your workbook with a list of all the worksheet
names. You can set the visible property for each sheet in the list, then click a button to hide
or unhide all the sheets based on the list.
This means you can setup the control sheet to a speci c view, so only speci c worksheets
are visible. Click the Run Update button and all sheets will be hidden/unhidden based on
your control sheet. This ensures that your report will show the correct sheets everytime you
send it out, and make you look really organized.
Conclusion
Unhiding multiple sheets at the same time in Excel will require code or a macro. There is one
other way using Custom Views, but it has limitations if you use Excel Tables (and I love
Tables).
Hopefully you learned some VBA code that you can implement. You can also add the macros
to your Personal Macro workbook to run them anytime you need.
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 8/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
If coding isnt your thing then checkout the Tab Hound add-in. It will save you time and
make your life a lot easier. (win-win!)
Jon Acampora
Welcome to Excel Campus! I am excited you are here. My name is Jon and
my goal is to help you learn Excel to save time with your job and advance in
your career. I've been an avid Excel user and VBA developer for 10+ years. I
am also a Microsoft MVP. I try to learn something new everyday, and want
to share this knowledge with you to help you improve your skills. When I'm
not looking at spreadsheets, I get outdoors and surf. :) more about me
Thanks again!
Reply
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 9/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
The rst suggestion helped so much! I use Excel 2016. Thank you!!
Reply
Reply
Jon,
Thank you, used rst option and worked great thank you for your
expertise and straight forward solutions, like the bookmark too Jerry!
Reply
Thanks Val!
Reply
THANK YOU!!!
Reply
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 10/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
Reply
Thanks Wade!
Reply
Hi Jon.
I need help. I want to create a macro where if the cell value is lets say
Calculation Method 1 and i click on a button beside it Calculate then
it will show only the worksheet speci c for calculation method 1. and if
Calculation Method 2 then worksheet for method 2 and so on.
Reply
Hi Abbie,
Sub Unhide_Multiple_Sheets()
Dim ws As Worksheet
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 11/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
End Sub
Reply
Reply
Reply
Hey Jon! Happy New Year! And GREAT STUFF! Keep it up!
Assign the macro to a new button in your ribbon or QAT for easy
access.
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 12/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
Oh, and the Bookmark feature works great in any multi-sheet VBA
operation to bring you back to the worksheet you started the macro
from.
Cheers! Jerry
Sub UnhideAllWorksheets()
If MsgBox(There are & ws & total sheets in this workbook. & vbCrLf
& vbCrLf & _
Do you want to expose the & hidden & hidden sheets?, _
vbQuestion + vbYesNo) vbYes Then Exit Sub
For j = 1 To ws
Sheets(j).Visible = True
Next
Bookmark.Activate
End Sub
Reply
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 13/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
Reply
Leave a Reply:
Name* Email*
SUBMIT
Search
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 14/15
7/31/2017 3 Ways to Unhide Multiple Sheets in Excel + VBA Macros
https://www.excelcampus.com/vba/unhide-multiple-sheets-excel/ 15/15