RAJESH1960
Banned for repeated rules violations
- Joined
- Mar 26, 2020
- Messages
- 2,313
- Office Version
- 2019
- Platform
- Windows
Hello guys,
I have 6 sheets in the workbook. I want to hide sheet "Data" and sheet "Steps". The other 3 sheets are working sheets say X, Y and Z sheets. With the help of a code I want to hide X, Y and Z sheets only at the end of the code. How do I edit this code not to hide the sheet "Data" and sheet "Steps"? With this code I am able to hide one sheet only. The X sheet gets hidden when the code ends.
I have 6 sheets in the workbook. I want to hide sheet "Data" and sheet "Steps". The other 3 sheets are working sheets say X, Y and Z sheets. With the help of a code I want to hide X, Y and Z sheets only at the end of the code. How do I edit this code not to hide the sheet "Data" and sheet "Steps"? With this code I am able to hide one sheet only. The X sheet gets hidden when the code ends.
Rich (BB code):
Option Explicit
Sub HideSheets()
Dim ws As Worksheet
For Each ws In Sheets(Array("X"))
ws.Visible = xlSheetVeryHidden
Next ws
End Sub
Sub UnHideSheets()
Dim ws As Worksheet
For Each ws In Worksheets: ws.Visible = xlSheetVisible
Next ws
End Sub
VBA Code:
Last edited: