VBA ISERROR Function (Syntax + Example)

- Written by Puneet

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 or 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 the VBA ISERROR function, you need to go through the below example where we have written a vba code by using it:

example-vba-iserror-function
Sub example_ISERROR()
Range("B1").Value = IsError(Range("A1"))
End Sub

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