Basically, title says it all. I would have thought this to be a fairly easy thing to find, but I cannot find the answer to this in any documentation, or on any forums.
This is my first time working with a collection object, but I understand it works similar to an array (although supposedly more optimized according to Chip Pearson who is somewhat of a VBA Guru).
I tried using UBound() to get the last item, but apparently this only works for arrays. Is there a similar function to get the last item in a collection?
To put it into context:
Any help is appreciated.Code:Sub Test() Dim Data As Collection Set Data = New Collection 'Add items to collection Data.Add "A" Data.Add "B" Data.Add "C" 'Remove last item from collection Data.Remove UBound(Data) 'This line does not work End Sub




Reply With Quote
