Thread: Collection
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Collection

Function CollectionContains(TxtValue as String) as Boolean
Dim MyObject as Object
CollectionContains = False
For each MyObject in ObjectName.CollectionName ' You need to put the actual
object and collection name in the code here
If MyObject.Value = TxtValue Then CollectionContains = True
Next MyObject
End Function

"Todd Huttenstine" wrote:

Hey

How do you test to see if a particular value is in a
collection object?

For example, I have a collection with 5 items in it. The
items in it a "abc", "def", "ghi", "jkl", and "mno".
How can I test to see if the value "jkl" is in this
collection, and return true or false?


Thanks
Todd