• Work with all sheets

    Author
    Topic
    #462584

    Is there a way to work with all sheets in a workbook without creating a (massive) array. I need to be able to protect and hide all worksheets in a workbook bar the home page.

    Viewing 1 reply thread
    Author
    Replies
    • #1177873

      I’d just loop through the worksheets collection:

      Code:
      	Dim oSh As Worksheet
      	'No visble sheets is not allowed, so
      	'make sure the home sheet is visible:
      	Worksheets("Home").Visible = xlSheetVisible
      	For Each oSh In ThisWorkbook.Worksheets
      		If Not oSh.Name = "Home" Then
      			oSh.Visible = xlSheetHidden
      		End Sub
      	Next
    • #1177875

      Thankyou, that makes life much easier!

    Viewing 1 reply thread
    Reply To: Work with all sheets

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: