In an Excel formula you can use =ISERR(A1) or =ISERROR(A1)
In a VBA macro you can use IsError(sheet.Cells(1, 1))
But using a VSTO Excel Addin project I did not found similar function under the Microsoft.Office.Interop.Excel API. I only want to know if there is an error in the cell, I’m not really interested in the type of error.
My current workaround is to do this for all the existing error messages.:
if (((Range)sheet.Cells[1, 1]).Text == "#N/A" || ...)
Is there a better way to do this. Is there a simple function in the API for that?
You can use the
WorksheetFunctionmethod:or
The
IsErris semantically identical to the Excel worksheet function, only instead of the cell reference pass in the actual value – AFAIK.