Excel 2003 - VBA - Checking to see if a sheet is present

  • Thread starter Thread starter Craig Brandt
  • Start date Start date
C

Craig Brandt

Hi,

What is a simple way to check to see if a sheet of a given name is present
in a workbook?

Thanks,
Craig
 
Dim Sht as object
set sht = nothing
on error resume next
set sht = activeworkbook.sheets("somesheetnamehere")
on error goto 0

if sht is nothing then
msgbox "nope"
else
msgbox "yep"
end if
 
Back
Top