ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Displaying programatically worksheet errors messages in a cell (https://www.excelbanter.com/excel-programming/404603-displaying-programatically-worksheet-errors-messages-cell.html)

Tom

Displaying programatically worksheet errors messages in a cell
 
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

Tom

Displaying programatically worksheet errors messages in a cell
 
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


All times are GMT +1. The time now is 12:14 PM.

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