Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub Sorting()
[COLOR=green]'declare variables[/color]
Dim ListString As Variant
Dim Item As Variant
[COLOR=green]'create collection[/color]
Dim CollList As New Collection
[COLOR=green]'create test array[/color]
ListString = Array("A", "B", "B", "A", "C")
[COLOR=green]'set error routine to skip duplicate key[/color]
On Error Resume Next
[COLOR=green]'loop through test array[/color]
For Each Item In ListString
[COLOR=green]'add item to collect using item as both item and key[/color]
[COLOR=green]'collections do not allow duplicate keys and raises error 457[/color]
[COLOR=green]'On Error Resume Next lets program continue on with stopping[/color]
CollList.Add Item, Item
Next
[COLOR=green]'turn off error handling[/color]
On Error GoTo 0
[COLOR=green]'display number of collection items in immediate window[/color]
Debug.Print CollList.Count
End Sub