How to check if a worksheet exists in worksheet collection

R

Raghunandan

Hi All,
I wanted to know if there is any method to check if a worksheet exists in worksheets collection.I want to check this by worksheet name.

Thanks in advance

Regards
Raghu
 
G

Greg Wilson

See John Walkenbauch's function:

j-walk.com/ss/excel/tips/tip54.htm#func5

-----Original Message-----
Hi All,
I wanted to know if there is any method to check if a
worksheet exists in worksheets collection.I want to check
this by worksheet name.
 
F

Frank Kabel

Hi
one way

dim wks as worksheet
on error resume next
set wks = activeworkbook.worksheets("your_wks_name")
on error goto 0
if wks is nothing then
msgbox "worksheet does not exist"
end if


--
Regards
Frank Kabel
Frankfurt, Germany

Raghunandan said:
Hi All,
I wanted to know if there is any method to check if a worksheet
exists in worksheets collection.I want to check this by worksheet name.
 
Top