README.md

December 5, 2022 ยท View on GitHub

Is in Array Function

Description

Find if a value exists in an array WITHOUT LOOPING. Often we need to find out if a value exists in an array. This one does it VERY FAST.

NOTE: This Function only return True / False regarding the Existence of a Value. If you need the Index you will have to LOOP.

More Info

Submitted On
ByBrian Gillham
LevelIntermediate
User Rating4.5 (27 globes from 6 users)
CompatibilityVB 6.0
CategoryVB function enhancement
WorldVisual Basic
Archive File

Source Code

Public Function IsInArray(FindValue As Variant, arrSearch As Variant) As Boolean
 On Error GoTo LocalError
 If Not IsArray(arrSearch) Then Exit Function
 If Not IsNumeric(FindValue) Then FindValue = UCase(FindValue)
 IsInArray = InStr(1, vbNullChar & Join(arrSearch, vbNullChar) & vbNullChar, vbNullChar & FindValue & vbNullChar) > 0
Exit Function
LocalError:
 'Justin (just in case)
End Function