Error handler help

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

Guest

Hi,
i am new to VB code but seem to be getting ok okish. i do however have a
problem with a routine. i press a button to email my contact in the excel
w/book. if there is a mail there, it sends etc. if the specific cell is
empty, it returns an error which i have to debug. can any one help me with a
handler for this. Here is mine but its not very good and prbably not
correct.( my email address appears in D12)

on Error GoTo ErrorHandler1 ( at top of routine )

End If
Range ("D12") = ""
GoTo ErrorHandler1
Exit Sub

ErrorHandler1:
MsgBox ("Contact must have email address"), , _
" Contacts message"
End Sub

help would be well received :)

Nigel
 
Hi Nigel,

Try this:

If Range ("D12") = "" Then
MsgBox ("Contact must have email address"), , _
" Contacts message"
Exit Sub
Else
'Your instructions to send e-mail here
End If

Reagrds,
KL
 

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

Back
Top