Hello everyone !
I searched on the Net how to sort a ListBox in descending order. Full of proposals but not always simple
I wrote a very small code that does this sorting.
In a new project, create ListBox 2: List1.Sorted = True, List2.Sorted = False, a CommandButton called Bt_Sort, and copy the code below:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | Option Explicit Dim i1 As Integer Private Sub bt_sort_Click() i1 = List1.ListCount - 1 Do Until i1 = -1 List1.ListIndex = i1 List2.AddItem List1.Text i1 = i1 - 1 Loop End Sub Private Sub Form_Load() List1.AddItem "aaa" List1.AddItem "bbb" List1.AddItem "ccc" List1.AddItem "ddd" List1.AddItem "eee" End Sub |
That’s all. It’s up to you to adapt this code to your needs.