VBA ISERROR Function (Syntax + Example)

Last Updated: June 22, 2023

- 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.




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


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:

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.