Displaying programatically worksheet errors messages in a cell

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,
I'm asking you about this maybe simple matter of how to display
worksheets error messages in a cell such as #N/A or incorrect args and
others programatically from Excel VBA.
I just wrote a simple user - defined function and in case for exapmle
the arguments passed to this function exceed bounds I would like the
function to display in the cell where the function is entered standard
excel worksheet error message. Has it something to do with:
Err.raise Error(errNumber) ? (but what errNumbers are for what
errors ?)
Could someone drop a few lines of code ?
Thanks
Tom
 
Hi, that's me again

Lucky must I be because after ploughing throug Excel VBA help I
finally found something.
the non-elegant solution seems to be:

Function nameOfFun(args...)
nameOfFun=Evaluate(strin) where strin= {"#VALUE!" | "#REF!" | "#DIV/
0!" | "#NUM!" |
"#NAME?" | "#NULL!" | "#N/A" } as String is a text representing one of
the above values
End Function

Luckily I suddenly remembered Eval or something like that function
from probably Jscript and it seems to do the trick.

Regards
Tom
 

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