📜  excel vba 模仿python中的“IN”运算符 - VBA代码示例

📅  最后修改于: 2022-03-11 14:51:53.845000             🧑  作者: Mango

代码示例1
'VBA does not have an IN operator, but we can do this:

Function IsIn(a, b) As Boolean
    IsIn = InStr("," & b & ",", "," & a & ",")
End Function

'--------------------------------------------------------------------

MsgBox IsIn(2, "1,2,3")          '<-- displays True
MsgBox IsIn("d", "a,b,c")      '<-- displays False