I want to check a #N/A
value into excel with VBA. So after some research, I made this code :
Set MyTab = Range(name)
If (Not IsEmpty(MyTab.value
You first need to check that the cell does contain an error:
If IsError(MyTab(i, j).Value) Then
If MyTab(i, j).Value <> CVErr(xlErrNA) Then
Unless you do want to know the type of error (#N/A, #DIV/0!, etc) , you might as well replace your test with:
If (Not IsEmpty(MyTab.value)) And (Not IsError(MyTab(i, j).value)) Then
If you need to check the error type, you can write:
Dim shouldBuildRequest As Boolean
shouldBuildRequest = Not IsEmpty(MyTab.value)
If IsError(MyTab(i, j).Value) Then
shouldBuildRequest = shouldBuildRequest AND (MyTab(i, j).Value <> CVErr(xlErrNA))
End If
If shouldBuildRequest Then
Call BuildRequest(False, id, MyTab, i, j)
End If
Another way to check for the error
If CVErr(MyTab(i, j).Value) = CVErr(xlErrNA)