I tried to emulate Excel IFERROR function.
I tried to do it in two ways:
[First]
Code: Select all
Function IFERROR(Expression as Variant, DefaultValue as Variant)
If ISERROR(Expression) Then
IFERROR = DefaultValue
Else
IFERROR = Expression
End If
End Function
Code: Select all
Function IFERROR(Expression as Variant, DefaultValue as Variant)
On Error Goto ERRHANDLER
IFERROR = Expression
Exit Function
ERRHANDLER:
IFERROR = DefaultValue
End Function
Is there any way to achieve this?
Thanks.