A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Function MyMatch(Lup As Variant, lookrng As Range) As Long
Dim c As Range
For Each c In lookrng
If c.Value = Lup Then
MyMatch = c.Row
End If
Next
End Function
I would add an Exit For or even an Exit Function line after the MyMatch = c.Row. No sense processing them all if it is found in the second row. Further, a non-case-sensitive match more closely resembles the native MATCH() function.
Function MyMatch(Lup As Variant, lookrng As Range) As Long
Dim c As Range
For Each c In lookrng
If LCase(c.Value) = LCase(Lup) Then
MyMatch = c.Row
Exit Function
End If
Next
End Function