View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Checking a worksheet is present

Dim TestWks as worksheet

set testwks = nothing
on error resume next
set testwks = worksheets("data")
on error goto 0

if testwks is nothing then
msgbox "your message here
else
'keep going...
end if

mmc308 wrote:

I have a macro that relies on a worksheet being present, however if the sheet
is missing I need to reply with a message box to tell the person to copy in
the worksheet

If Worksheet ("data") = False Then
MsgBox "You need to copy of the data worksheet."
Else
Continue with Macro
End If

TIA
mmc308


--

Dave Peterson