Code:
Sub dicItemExists_Test()
Dim i As Long
Dim arList As Object
Dim dicTest As Object
On Error GoTo lblError
'arList.contains will tell you if an item exists in the list (not if in an arrary that is part of the list).
Set arList = CreateObject("System.Collections.Arraylist")
arList.Add "Apples"
arList.Add "Peaches"
arList.Add "Pears"
MsgBox arList.Contains("Pears")
'dicTest.Exists will tell you if a "Key" exists in a dictionary
Set dicTest = CreateObject("Scripting.Dictionary")
dicTest.Add "Key2", "AAA"
dicTest.Add "Key3", "BBB"
dicTest.Add "Key1", "CCC"
MsgBox dicTest.Exists("Key1")
'So, you could use"
Set dicTest = CreateObject("Scripting.Dictionary")
dicTest.Add "AAA", "AAAA"
dicTest.Add "BBB", "BBB"
dicTest.Add "CCC", "CCC"
MsgBox dicTest.Exists("CCC")
'AFAIK, the only way to check if a "value" exists is to loop as you are trying to avoid.
lblExit:
Set dicTest = Nothing
Set arList = Nothing
Exit Sub
lblError:
Debug.Print "Got error: " & Err.Number & ", " & Err.Description
GoTo lblExit
End Sub