![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 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? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
Perhaps it's because the error is...
#NULL! |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
Sorry, that was a typo in the post, my code is checking for "#NULL!"...
|
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Austin, Texas USA
Posts: 11,654
|
...but, Excel error values are not text strings. "#NULL!" is quite different from #NULL!.
|
|
|
|
|
|
#5 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 ] |
|
|
|
|
|
#6 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
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 ] |
|
|
|
|
|
#7 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
OK, I'm equipped with a fresh coffee... Bring on the suggestions!!!
|
|
|
|
|
|
#8 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
Should I get another coffee???
|
|
|
|
|
|
#9 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 |
|
|
|
|
|
#10 |
|
Board Regular
Join Date: Feb 2002
Posts: 97
|
Sorry, but will that not simply check for the actual string "Error" in that cell?
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|