You can use the Match WorksheetFunction like this:
Code:Sub Test() Const var As String = "var" Dim projects As Variant Dim x As Long projects = Array("x", "var", "y") On Error Resume Next x = WorksheetFunction.Match(var, projects, False) If Err = 0 Then ' **** do something **** MsgBox "Found" Else ' **** clear error **** Err.Clear MsgBox "Not Found" End If On Error GoTo 0 End Sub


LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks