ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   error code help (https://www.excelbanter.com/excel-programming/354030-error-code-help.html)

vbidiot[_4_]

error code help
 

i want to write an error statement but it's not working for me.
The code below works when the cell value equals #n/a BUT it screws up
my macro when the the cell value doesn't equal #n/a. I'm getting an
error 13...
I tried to use an error 13 statement but no such luck either. Here's my
code below.


Code:
--------------------

If Range("ssn") = CVErr(xlErrNA) Then
MsgBox ("NAME NOT FOUND!!!!")
Exit Sub
End If
--------------------


--
vbidiot
------------------------------------------------------------------------
vbidiot's Profile: http://www.excelforum.com/member.php...o&userid=31582
View this thread: http://www.excelforum.com/showthread...hreadid=515319


Chip Pearson

error code help
 
Use IsError.

If IsError(Range("ssn")) = True Then
MsgBox ("NAME N=na()OT FOUND!!!!")
Exit Sub
End If



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"vbidiot"
wrote in message
...

i want to write an error statement but it's not working for me.
The code below works when the cell value equals #n/a BUT it
screws up
my macro when the the cell value doesn't equal #n/a. I'm
getting an
error 13...
I tried to use an error 13 statement but no such luck either.
Here's my
code below.


Code:
--------------------

If Range("ssn") = CVErr(xlErrNA) Then
MsgBox ("NAME NOT FOUND!!!!")
Exit Sub
End If
--------------------


--
vbidiot
------------------------------------------------------------------------
vbidiot's Profile:
http://www.excelforum.com/member.php...o&userid=31582
View this thread:
http://www.excelforum.com/showthread...hreadid=515319




vbidiot[_5_]

error code help
 

I was trying to use the ISerror but I was screwing it up royally!
Thank you sir for the quick reply. Hopefully I can help you someday...I
doubt I will be able to...but you never know:)


--
vbidiot
------------------------------------------------------------------------
vbidiot's Profile: http://www.excelforum.com/member.php...o&userid=31582
View this thread: http://www.excelforum.com/showthread...hreadid=515319



All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com