bekibutton
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?
Thanks

Becki
freakazeud
Dec 1 2005, 12:55 PM
Hi,
try:
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
End Function
Then you can use it this way:
If Not SheetExists(Workbooks("WorkbookName.xls"), "MySheetName") Then
MsgBox "MySheetName doesn't exist!"
Else
MsgBox "MySheetName exist!"
End If
Untested!
HTH
Good luck