VBA CODE to Hide/Unhide all worksheets

If you want to unhide all the worksheet using vba code.

Use following programs to unhide the sheet.

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

————————————-Hide all worksheet except active sheet ———————————————

Sub HideAllExceptActive()
Dim ws As Worksheet

‘ Loop through all the worksheets in the workbook
For Each ws In ActiveWorkbook.Worksheets
‘ Check if the worksheet is the active one
If ws.Name <> ActiveSheet.Name Then
‘ Hide the worksheet
ws.Visible = xlSheetHidden
End If
Next ws

MsgBox “All worksheets except ‘” & ActiveSheet.Name & “‘ have been hidden.”, vbInformation
End Sub