Removing Objects from a Collection
Sub deleteEmployees() ' declare the employees collection Dim colEmployees As New Collection ' declare a variable to hold each element of a collection Dim emp As Variant ' Add 3 new employees to the collection With colEmployees .Add Item:="John Collins", Key:="128634456" .Add Item:="Mary Poppins", Key:="223998765" .Add Item:="Karen Loza", Key:="120228876", Before:=2 End With ' list the members of the collection For Each emp In colEmployees Debug.Print emp Next MsgBox "There are " & colEmployees.Count & " employees." colEmployees.Remove (3) MsgBox colEmployees.Count & " employees remain." End Sub