View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Checking a worksheet is present

One way:

Dim ws As Worksheet
On Error Resume Next
Set ws = ActiveWorkbook.Worksheets("data")
On Error GoTo 0
If ws Is Nothing Then
MsgBox "You need to copy of the data worksheet."
Else
'Continue with Macro
End If



In article ,
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