LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Collection

Todd,

Here is a function to test it

Public Function IfExists(col As Collection, ByVal sKey As String)

On Error GoTo NoSuchKey

If VarType(col.Item(sKey)) = vbObject Then
' force an error condition if key does not exist
End If

IfExists = True

Exit Function

NoSuchKey:
IfExists = False

End Function





--

HTH

RP
(remove nothere from the email address if mailing direct)


"Todd Huttenstine" wrote in message
...
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





 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with data collection! brandon roland[_2_] New Users to Excel 1 August 8th 07 10:09 PM
Does anybody have a CD collection template PeterM Excel Discussion (Misc queries) 2 November 27th 04 05:46 PM
Reset New Collection Tony Di Stasi[_2_] Excel Programming 2 February 19th 04 03:21 PM
2 Collection questions Stuart[_5_] Excel Programming 5 January 30th 04 04:50 PM
Names Collection MarkC[_2_] Excel Programming 2 January 28th 04 10:47 AM


All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"