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

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
 
D

Dave Peterson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top