Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Problem trapping an error
Hello,
I am writing a function to show the error number and name for errors found in an Excel worksheet cell. I am passing the cell contents to the function "Show_Error_Number(Val1 as variant) and then working with the error in the function. The first step is to capture and debug.print the error number. However, I've been unable to actually capture the number using Err.Number or Error.Type. How can I do this. My code is shown below. Public Function Show_Error_Number(val1 As Variant) If IsError(val1) Then Debug.print val1 ' for #NUM! error this prints "Error 2036" but I am unable to work with it as a string 'Show_Error_Number = Err.Number ' doesn't work Show_Error_Number = Error.Type ' doesn't work Else Show_Error_Number = 99999999 End If Thanks Keith End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Error Trapping | Excel Discussion (Misc queries) | |||
error trapping | Excel Discussion (Misc queries) | |||
trapping error | Excel Programming | |||
Error Trapping | Excel Programming | |||
error trapping | Excel Programming |