How to use the VBA ISERROR Function (Syntax + Example)

HomeVBA Functions LIST (Category Wise)How to use the VBA ISERROR Function (Syntax + Example)

The VBA ISERROR function is listed under the information category of VBA functions. When you use it in a VBA code, it evaluates the supplied expression and returns TRUE if it is an error else FALSE. In simple words, it can check whether the value supplied is an error or not and returns TRUE or FALSE based on that. It’s equivalent to the worksheet’s ISERROR function.

Syntax

IsError(Expression)

Arguments

  • Expression: An expression that you want to test if it’s an error or not.

Example

To practically understand how to use VBA ISERROR function, you need to go through the below example where we have written a vba code by using it:

Sub example_ISERROR()
Range("B1").Value = IsError(Range("A1"))
End Sub

In the above code, we have used ISERROR to check if the cell A1 has an error or not, as a result, it has returned TRUE as we have an #N/A error in the cell A1.

Related Functions

ISARRAY | ISDATE | ISEMPTY | ISMISSING | ISNULL | ISNUMERIC | ISOBJECT