vba imitating the in operator from other languages code example
Example: excel vba imitating the in operator from other languages
'VBA does not have an IN operator, but we can do this:
Function IsIn(a, b) As Boolean
IsIn = InStrB("," & b & ",", "," & a & ",")
End Function
'--------------------------------------------------------------------
MsgBox IsIn(2, "1,2,3") '<-- displays True
MsgBox IsIn("d", "a,b,c") '<-- displays False