End Macro If Cell Formula produces "#VALUE!"

S

slim

I'd like to make a small error catch in a macro that will halt it if a
formula produces an error of #VALUE!

I was thinking something like this:

If Range("C25").Value = "#VALUE!" Then
MsgBox "Please Login before executing this macro"
Exit Sub
End If

Obviously my syntax is off. Can someone help me with this?

Thanks.
 
G

Gary Keramidas

you could use something like this

If IsError(Range("a1")) Then
MsgBox "Please Login before executing this macro"
Exit Sub
End If
 
B

Bob Phillips

If IsError(Range("C25").Value) Then
MsgBox "Please Login before executing this macro"
Exit Sub
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)
 
S

slim

Excellent...works great...Thanks!
Bob Phillips said:
If IsError(Range("C25").Value) Then
MsgBox "Please Login before executing this macro"
Exit Sub
End If


--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Top