How do I sort a collection?

后端 未结 9 2033
臣服心动
臣服心动 2020-11-27 05:03

Does anyone know how to sort a collection in VBA?

9条回答
  •  暖寄归人
    2020-11-27 05:42

    There is no native sort for the Collection in VBA, but since you can access items in the collection via index, you can implement a sorting algorithm to go through the collection and sort into a new collection.

    Here's a HeapSort algorithm implementation for VBA/VB 6.

    Here's what appears to be a BubbleSort algorithm implementation for VBA/VB6.

提交回复
热议问题