CompareValue - Check whether a value is in a list of values
' Compares a numeric or string value with a list of other values.
' Returns the 1-based index of the matching value, or zero if the
' value doesn't appear in the list.
' String comparisons are case-sensitive.
'
' This function can conveniently replace a Select Case or a list
' of ORed comparison, e.g. you can replace the following line
' If s = "one" Or s = "Two" Or s = "Three" Then
' with the more concise
' If CompareValue(s, "One", "Two", "Three") Then
Function CompareValue(ByVal value As Object, ByVal ParamArray valueList() As _
Object) As Integer
Return Array.IndexOf(valueList, value) + 1
End Function