G Guest Aug 25, 2004 #1 I need the syntax for checking that a given sheet exist identified by it's CODE name. Is anybody game? The Doctor
I need the syntax for checking that a given sheet exist identified by it's CODE name. Is anybody game? The Doctor
R RB Smissaert Aug 25, 2004 #2 Something like this will do it: Function TestForSheet(lSheetNumber As Long) As Boolean Dim strSheetName As String On Error Resume Next strSheetName = Sheets(lSheetNumber).Name If Err.Number = 0 Then TestForSheet = True Else TestForSheet = False End If On Error GoTo 0 End Function Sub test() MsgBox TestForSheet(100) End Sub RBS
Something like this will do it: Function TestForSheet(lSheetNumber As Long) As Boolean Dim strSheetName As String On Error Resume Next strSheetName = Sheets(lSheetNumber).Name If Err.Number = 0 Then TestForSheet = True Else TestForSheet = False End If On Error GoTo 0 End Function Sub test() MsgBox TestForSheet(100) End Sub RBS