• Removing Items from a Collection (2003)

    Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Removing Items from a Collection (2003)

    Author
    Topic
    #450990

    Hi all,
    I’m playing around with Class Modules for the first time, and was wondering:
    The class I’m using contains data about a worksheet and it’s formatting and used range. I’ve got a number of these new class objects in a collection. I would like to loop through these objects several times. With each loop, some sheets will be determined to have no more problems to be fixed, and should be removed from the collection.
    Is there a simple way to remove these objects from the collection while looping with For Each, or is it best to just use something like For x = colMyCollection.count to 1 step -1 and remove by item number?
    Hope this was clear. Thanks!

    Viewing 0 reply threads
    Author
    Replies
    • #1109190

      I think the latter: looping with the item number. I have found that the “each” may get “confused” when things are deleted from (and even added to ) the collection during the looping.

      Steve

    Viewing 0 reply threads
    Reply To: Removing Items from a Collection (2003)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: