Macro to check for existence of a sheet
Public Function SheetExists(ByVal sSheetName As String) As Boolean
' Returns TRUE if the sheet exists
On Error GoTo ErrHandler_SheetExists
SheetExists = False
If Sheets(sSheetName).Visible = True Or Sheets(sSheetName).Visible = False Then
SheetExists = True
End If
Exit Function
ErrHandler_SheetExists:
SheetExists = False
End Function
' Returns TRUE if the sheet exists
On Error GoTo ErrHandler_SheetExists
SheetExists = False
If Sheets(sSheetName).Visible = True Or Sheets(sSheetName).Visible = False Then
SheetExists = True
End If
Exit Function
ErrHandler_SheetExists:
SheetExists = False
End Function