Find worksheet
Try this
Sub test()
MsgBox "Sheet1 Esists? " & SheetExists("Sheet1")
MsgBox "asdf Esists? " & SheetExists("asdf")
End Sub
Public Function SheetExists(ByVal SheetName As String) As Boolean
Dim wks As Worksheet
Dim blnReturnValue As Boolean
blnReturnValue = False
For Each wks In Worksheets
If wks.Name = SheetName Then blnReturnValue = True
Next wks
SheetExists = blnReturnValue
End Function
HTH
"cottage6" wrote:
I'm working with some code that opens a file and then needs to determine if a
specific worksheet exists in that file. How can I determine that? Thanks as
always!
|