Using the below Boolean function to check if the cell value equals "M8D" or "M8P" or "M20")
Function m8_field(ByVal plf As String) As Boolean
m8_field = (plf = "M8D" Or plf = "M8P" Or plf = "M20")
End Function
And I use it like below and it works:
Dim arg As Range: Set arg = ActiveSheet.Range("D1:E20")
Dim arr: arr = arg.Value2
Dim r As Long
For r = 1 To UBound(arr)
If m8_field(arr(r, 2)) Then arr(r, 1) = "Good"
Next
What I need to change the last line :
If m8_field(arr(r, 2)) Then arr(r, 1) = "Good"
Into
If arr(r, 2) = m8_field Then arr(r, 1) = "Good"
But I got
Compile error:Argument not optional on this part (
m8_field)
In advance any learning help will be appreciated