This code works fine
Dim MyArray
MyArray = Array("fee", "fi", "fo", "fum")
If Application.Match("fee", MyArray, 0) Then
Debug.Print "Pass"
End If
However, this code throws a type mismatch error on the if statement
Dim MyArray
MyArray = Array("fee", "fi", "fo", "fum")
If Application.Match("foo", MyArray, 0) Then
Debug.Print "Pass"
End If
What am I missing?
If IsNumeric(Application.Match("foo", MyArray, 0)) ThenorIf Not IsError(Application.Match("foo", MyArray, 0)) ThenIsNAin VBA. I preferIsNumericin this case, but it's all the same because the result can only be an integer (whole number) or a#N/Aerror.