Hi I am trying to create a script where it hides all sheets except for the specified ones, however, other people either change the name of the sheet, or add their own. I am having issues where the script uses the sheet index as opposed to the name.
![]()
Sub HideSheets() Dim sh As Worksheet Application.ScreenUpdating = False For Each sh In ActiveWorkbook.Sheets If sh <> sheet1.Name or sh <> sheet2.Name Then sh.Visible = xlSheetHidden Next Application.ScreenUpdating = True End Sub
Bookmarks