0

I encountered the following code:

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

What it does is to use a loop to hide all worksheets in the active workbook, except the active sheet. What is xlSheetHidden and why is it not defined?

Ben Rhys-Lewis
  • 3,118
  • 8
  • 34
  • 45
user91820
  • 3
  • 1
  • 2
    Please try searching next time. This was one of the top hits on a Google search for "xlSheetHidden": http://stackoverflow.com/questions/853270/hiding-an-excel-sheet. Also: https://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlsheetvisibility.aspx – Brian Snow Jan 30 '16 at 02:17

1 Answers1

1

Its an enumeration. Normally something like this would be True or False, but here we have three possibilities, including xlSheetVeryHidden

Gary's Student
  • 95,722
  • 10
  • 59
  • 99