判断数组中是否含有某元素

Sub macro1()
    Dim arr, i%
    arr = Array(1, 2, 3, 4, 5, 6)
    On Error Resume Next
    i = WorksheetFunction.Match(9, arr, 0)
    If i > 0 Then MsgBox "存在" Else MsgBox "不存在"
End Sub
原文地址:https://www.cnblogs.com/lxshanye/p/2877935.html