'********************************************************************
'*
'* Function SequentialSearch
'*
'* Author: NetworkAdminKB.com
'* Created: 2005-01-10
'* Modified: 2005-01-10
'*
'* Purpose: Search for and Return the Index of an element in an
'* unorder/unsorted Array.
'*
'* Input: aryAny = The unorder/unsorted Array to Search.
'* anyVar = The item to search for in the Array
'* blnCase = A boolean indicating a Case Sensitve Search.
'* True = Case Sensitive
'* False = Case InSensitive
'*
'* Output: Return the index of the location of the element, or Return
'* Empty if the item is not found.
'*
'* Notes: Assumes all items are unique. If they are not unique the
'* first item encountered is returned.
'*
'********************************************************************
Function SequentialSearch(ByVal aryAny, ByVal anyVar, ByVal blnCase)
'Version 1.0 2005-01-10
Dim x
SequentialSearch = Empty
'Perform a sequential search on the array.
For x = 0 to UBound(aryAny)
If blnCase Then
If anyVar = aryAny(x) Then
SequentialSearch = x
Exit For
End If 'anyVar = aryAny(x)
Else
If LCase(anyVar) = LCase(aryAny(x)) Then
SequentialSearch = x
Exit For
End If 'anyVar = aryAny(x)
End If 'blnCase
Next 'x
End Function 'SequentialSearch
Article ID: 420, Created On: 9/25/2011, Modified: 9/25/2011