If a worksheet name is = to test then a msgbox appears

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm looking for a macro that will display a msgbox if a worksheet is = to test.

For example, if the name of a sheet in a workbook is equal to test then
display msgbox saying sheet already exists.

Thanks

Vick
 
dim ws as worksheet
set ws = nothing
on error resume next
set ws = worksheets("test")
on error goto 0

if ws is nothing then
msgbox "doesn't exist"
else
msgbox "already exists"
end if
 
Back
Top