This is a workbook Macro.
This needs to be posted in a specific part of the workbook.
Select Developer and then visual basic
Select View and then Project Explorer
In the List that opens, find your project and double click on "This Workbook"
Paste this macro in the module that opens.
NB: I have written the macro so it is easy to expand and update.
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
MyArray = Split("Sheet1,Sheet2,Sheet3,Sheet4", ",")
Pos = Application.Match(ActiveSheet.Name, MyArray, 0)
If IsError(Pos) Then
For Count = 0 To UBound(MyArray)
Sheets(MyArray(Count)).Visible = False
Next
End If
End Sub
Bookmarks