VBA ISERROR Function (Syntax + Example)

Last Updated: June 22, 2023
puneet-gogia-excel-champs

- 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 have used ISERROR to check if cell A1 has an error or not, as a result, it has returned TRUE as we have an #N/A error in cell A1.