Hiding and Unhiding Worksheets
Sub HideWorksheet(sName As String, bVeryHidden As Boolean)
If WorksheetExists(ThisWorkbook, sName) Then
If bVeryHidden Then
ThisWorkbook.Worksheets(sName).Visible = xlSheetVeryHidden
Else
ThisWorkbook.Worksheets(sName).Visible = xlSheetHidden
End If
End If
End Sub
Function WorksheetExists(wb As Workbook, sName As String) As Boolean
Dim s As String
On Error GoTo bWorksheetExistsErr
s = wb.Worksheets(sName).Name
WorksheetExists = True
Exit Function
bWorksheetExistsErr:
WorksheetExists = False
End Function
Related examples in the same category