I'd say the simplest way is to put the values into a Dictionary
:
Set d = CreateObject("Scripting.Dictionary")
For Each e In arrayList
d(e) = e
Next
arr = d.Items 'put unique elements back into
If your array list contains objects and you don't want the object reference as the uniqueness indicator you need to identify some kind of property (or combination of properties) that defines the uniqueness of your objects and use that as the key in the dictionary. You also need to use the Set
keyword for assigning objects.
For Each e In arrayList
Set d(e.uniqueProperty) = e
Next
If you want the unique list back in the original variable you need another loop to transfer the elements from the dictionary back to the array list:
arrayList.Clear
For Each e In d.Items
arrayList.Add e
Next