excel vba check if key is in collection

The solution for “excel vba check if key is in collection” can be found here. The following code will assist you in solving the problem.

‘A Dictionary is a better choice when you need to determine if a key
‘is already in the collection. But here is a VBA function that
‘reports True or False for Collections:

Function KeyExists(key$, c As Collection)
On Error Resume Next
c.Item key
KeyExists = Err = 0: Err.Clear
End Function


MsgBox KeyExists(“Netflix”, colFANG)

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts