IsNA(match

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

Was wondering if you could help me, I have the following function:

Function NOT_IN(value, range)


NOT_IN = Application.IsNA(Application.Match(1, "C6:j6", 0))

End Function

The Function reads False in the cell no matter what I do, can anyone help??
 
I'd use something like:

Option Explicit
Function NOT_IN(myValue As Variant, myRange As Range) As Boolean
NOT_IN = CBool(IsError(Application.Match(myValue, myRange, 0)))
End Function

Tested with:
Sub testme()
MsgBox NOT_IN("asdf", Worksheets("sheet1").Range("a1:A99"))
End Sub

I'd stay away from variables named Value and Range.
 
Back
Top