Hi
I have a workbook with 2 worksheets "AppID" and "Server - Detail".
I have the following two subroutines that I want to use to show and hide these worksheets.
The problem I'm encountering is when I run the "hideSheets" code it stops when trying to hide the second of the two sheets (whichever order I put them in) with an error:
"RTE:'1004':
Unable to set the visible property of the Worksheet class"
It appears that the code is actually hiding the workbook when it hides the first sheet, and therefore when it tries to hide the second sheet it cannot find it to hide.....
Any ideas...?
I have a workbook with 2 worksheets "AppID" and "Server - Detail".
I have the following two subroutines that I want to use to show and hide these worksheets.
The problem I'm encountering is when I run the "hideSheets" code it stops when trying to hide the second of the two sheets (whichever order I put them in) with an error:
"RTE:'1004':
Unable to set the visible property of the Worksheet class"
It appears that the code is actually hiding the workbook when it hides the first sheet, and therefore when it tries to hide the second sheet it cannot find it to hide.....
Code:
Sub hideSheets()
ThisWorkbook.Worksheets("AppID").Visible = xlSheetVeryHidden
ThisWorkbook.Worksheets("Server - Detail").Visible = xlSheetVeryHidden
End Sub
Sub showSheets()
ThisWorkbook.Worksheets("AppID").Visible = xlSheetVisibile
ThisWorkbook.Worksheets("Server - Detail").Visible = xlSheetVisible
End Sub
Any ideas...?