IsError?

charlie79

Board Regular
Joined
Feb 27, 2002
Messages
97
Can I use the excel IsError function in VBA code? I have a refresh timer running every five secs, and from time to time, some cells contain !NULL#. This is a result of a add-in bug. I am checking for the string "!NULL#" right now, but it doesn't seem to work. I'm using something like:
if cells(6, 1).value = "!NULL#" then
do something
else
do something else
end if
Any ideas?
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
...but, Excel error values are not text strings. "#NULL!" is quite different from #NULL!.
 
Upvote 0
Hi
If using VBA, Excel will return a value of
Error 2000 if the cell contains the #NULL!
error.
Here's a few other returns:

#NULL! Error 2000
#NAME? Error 2029
#DIV/0! Error 2027
#VALUE! Error 2015
#NUM! Error 2036

Tom
This message was edited by TsTom on 2002-04-02 07:23
 
Upvote 0
I'm sorry, maybe I'm dumb, but I'm not following. Are you saying I should be doing
If cells(6, 1).value = #NULL! then
do something
end if
?
And what about this Error 2000 thing, how do I use that as far a code goes... Sorry guys, maybe I should go grab another coffe...
?
This message was edited by charlie79 on 2002-04-02 07:21
 
Upvote 0
Hi
If #NULL! is the only error value you are concerned with than this might work for you.

In your example:

if cells(6, 1).value = "!NULL#" then
do something
else
do something else
end if

The below will return "Error" if an error
is in the cell.
I do not know how to distinguish between
different errors?

Dim MyType As String
MyType = TypeName(Cells(6, 1).Value)
If MyType = "Error" Then
'do something
Else
'do something else
End If

Good Luck!
Tom
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,949
Members
448,534
Latest member
benefuexx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top