Environment: VBA
Function: To reverse a collection
Dim Reversed As Collection
Set Reversed = New Collection ‘DONT FORGET THIS
For i = 1 To Collection.Count ‘Collection Starts with 1!
Reversed.Add(Collection.Item(Collection.Count – i + 1))
Next
Environment: VBA
Function: To reverse a collection
Dim Reversed As Collection
Set Reversed = New Collection ‘DONT FORGET THIS
For i = 1 To Collection.Count ‘Collection Starts with 1!
Reversed.Add(Collection.Item(Collection.Count – i + 1))
Next
Note that VBA Collection starts with an annoying 1, while IpointCollection starts with 0. phew.
WHAT! VBA collection does not allow you to alter an item!!!
And its Array object is weird. I still have not found out how to use it yet.
To substitute an item in a VBA collection, make this call:
pFeat.Add Item:=”Item”, Before:=j
pFeat.Remove j + 1