FindIn1DArray

Returns 1 if an item found in array, 0 if not

CodeFunctionName
What is this?

Public

Tested

Original Work
Public Function FindIn1DArray(FindValue As Variant, arrSearch() As Variant)
Dim strStore As String ' Holds array as single string
Dim intPos As Integer ' Holds position of found elemt in array
FindIn1DArray = 0
Sepa = "{{$$}}"
On Error GoTo ByeBye
' Check to see if array passed
If IsArray(arrSearch) Then
strStore = Join(arrSearch, Sepa) ' Turn the array into a string
strStore = Sepa & strStore & Sepa ' Place Sepa at both ends of the string
'================================================
' Find the position of the elemt you are checking
' For returns 0 if not in the array set to vbBinaryCompare so that BOMB < > bomb
'================================================
intPos = InStr(1, strStore, Sepa & FindValue & Sepa, vbBinaryCompare)
If intPos > 0 Then FindIn1DArray = 1
End If
ByeBye:
On Error GoTo 0
End Function

FindValue, arrSearch()

Views 4,415

Downloads 1,522

CodeID
DB ID

ANmarAmdeen
609
Revisions

v1.0

Wednesday
June
6
2018