Macro to Hide and UnHide worksheets in Excel


Hide All worksheets in a workbook (Except Active sheet)


Sub HideSheets()
Dim XLnCAD As Worksheet
For Each XLnCAD In ThisWorkbook.Worksheets
If XLnCAD.Name <> ThisWorkbook.ActiveSheet.Name Then
XLnCAD.Visible = xlSheetHidden
End If
Next XLnCAD
End Sub

Unhide Every Hidden sheet in an Excel Workbook


Sub UnHideSheets()
Dim XLnCAD As Worksheet
For Each XLnCAD In ActiveWorkbook.Worksheets
XLnCAD.Visible = xlSheetVisible
Next XLnCAD
End Sub

Leave a Reply

Your email address will not be published.Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.