Suppose you have a workbook with many hidden sheets and you want to unhide them all at once. Here's some simple code to unhide all sheets in a workbook. In this case, I assume it is the ActiveWorkbook.
VBA Code
Sub UnhideAllSheets()
On Error GoTo ErrMsg:
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.Visible = xlSheetVisible
Next ws
MsgBox "Done!", vbInformation, "UnhideAllSheets()"
ExitHere:
Exit Sub
ErrMsg:
MsgBox Err.Number & ": " & Err.Description, _
vbExclamation, "UnhideAllSheets()"
GoTo ExitHere
End Sub
Link
- Workbook Object: https://msdn.microsoft.com/en-us/vba/excel-vba/articles/workbook-object-excel
- ActiveWorkbook Property: https://msdn.microsoft.com/en-us/VBA/Excel-VBA/articles/application-activeworkbook-property-excel
- Worksheet.Visible Property: https://msdn.microsoft.com/en-us/vba/excel-vba/articles/worksheet-visible-property-excel
- XlSheetVisibility Enumeration (xlSheetVisible, xlSheetHidden, xlSheetVeryHidden): https://msdn.microsoft.com/en-us/vba/excel-vba/articles/xlsheetvisibility-enumeration-excel