![]() |
|
#4
|
||||
|
||||
|
I would do this by converting the ArrayList to an Array and then use Join with a delimiter to get all the contents into one string. Then use InStr to find out if the element exists. For example
Code:
Sub dicItemExists_Test()
Dim i As Long, dicTest As Object
Dim arList As Object, arr As Variant, str As Variant, sFind As String
Set dicTest = CreateObject("Scripting.Dictionary")
Set arList = CreateObject("System.Collections.Arraylist")
dicTest.Add "Key2", "Item 2"
dicTest.Add "Key3", "Item 3"
dicTest.Add "Key1", "Item 1"
arList.Add dicTest.Items
arr = arList.ToArray
str = "|" & Join(arr(0), "|") & "|"
sFind = "|" & "Item 4" & "|"
Debug.Print InStr(str, sFind) > 0
sFind = "|" & "Item 3" & "|"
Debug.Print InStr(str, sFind) > 0
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
| Tags |
| arraylist contains, dictionary, indexof |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Test, just a test | Thomasordef | Office | 0 | 07-25-2019 10:43 AM |
| Student's t-test (T.TEST): how to get p value? | seanspotatobusiness | Excel | 1 | 07-20-2018 05:46 AM |
How do I make a checkbox or dropdown item reference data in that specific section of the data array?
|
dhare | Excel Programming | 2 | 02-24-2016 12:36 PM |
Copying data related to one item to worksheet with many instances of the same item
|
nmp13 | Excel | 3 | 02-06-2016 02:13 AM |
Convert String Array to Integer Array from a User Input?
|
tinfanide | Excel Programming | 4 | 12-26-2012 08:56 PM |