August 22, 2020

How to unhide all the hidden sheets at once - Microsoft Excel

 When working with big dashboards we hide lots of backend sheets so that final dashboard is clean.

The easy part if hiding multiple sheets, this can be done easily. But how to you unhide all sheets or specific sheets.

Below code will help you unhide all the sheets. hit Alt+F11. Go to Insert Menu -> "Module" and enter the below code.

Sub UnhideAllSheets()

'Unhide all sheets in workbook.
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
End Sub

But what if only few sheets needs to be unhidden. In these cases use the below code which will prompt you before unhiding a hide until the last hidden sheet.

Sub UnhideFewSheets()

'Unhide all sheets in workbook.
Dim ws As Worksheet
Dim question As VbMegBoxResult
For Each ws In ActiveWorkbook.Worksheets
If ws.Visible = xlSheetHidden then
Question = Msgbox("Do you want to Unhide" & ws.Name &"?", vbYesNo, "Sheets will be unhidden")

If Question = vbYes then ws.Visible = xlSheetVisible
End If

Next
End Sub

Thanks for visiting. If you have any questions reach out to me directly at askme.kkhelps@gmail.com

No comments: