Find a worksheet

  • Thread starter Thread starter Luis
  • Start date Start date
L

Luis

Hello.
I need to check if a certain worksheet exists in a
workbook.
Is there something like a find worksheet ?

Thanks
Luis
 
Hello.
I need to check if a certain worksheet exists in a
workbook.
Is there something like a find worksheet ?

Thanks
Luis

This should do the trick:
********************************************
Sub FindSheet()

Dim oSheet As Object

For Each oSheet In ActiveWorkbook.Sheets
If oSheet.Name = "Sheet3" Then
MsgBox "Found the sheet!", vbOKOnly
End If
Next

End Sub
********************************************
Good luck,

CoRrRan
 
Hi
try something like
dim wks as worksheet
on error resume next
set wks = worksheets("your_name")
on error goto 0
if wks is nothing then
msgbox "worksheet does not exist"
end if
 
Back
Top