Ways to hide a worksheet using VBA
By default, worksheets are visible. Some worksheets however contain data not intended to be seen by the user in which case the worksheets property visibility can be changed.
If you want to easily change the visiblity of the worksheet via the menu:
Dim ws As Worksheet: Set ws =
ws.Visible = XlSheetVisibility.xlSheetHidden
Note |
---|
At least one worksheet must be visible at all times |
If you want to allow the users to make the worksheet visible via the menu:
Dim ws As Worksheet: Set ws =
ws.Visible = XlSheetVisibility.xlSheetVeryHidden
If you want to unhide / make the sheet visible using vba:
Dim ws As Worksheet: Set ws =
ws.Visible = XlSheetVisibility.xlSheetVisible