Dec 1 2005, 12:34 PM
I can use this
code to determine if a sheet exists in the current workbook.
Can anyone point me in the right direction for modifying it so that it could look in a different workbook?
Dec 1 2005, 12:55 PM
Function SheetExists(wb As Workbook, strSheetName As String) As Boolean
' returns TRUE if the sheet exists in wb
SheetExists = False
On Error Resume Next
SheetExists = Len(wb.Sheets(strSheetName).Name) > 0
On Error GoTo 0
Then you can use it this way:
If Not SheetExists(Workbooks("WorkbookName.xls"), "MySheetName") Then
MsgBox "MySheetName doesn't exist!"
MsgBox "MySheetName exist!"