When you have an array of values, how can you use VBA to sort them?
Download simple Bubble Sort VBA code as well as code to sort a 2-dimensional array by any column
https://msaccessgurus.com/VBA/Array_S...
00:01 How does Bubble Sort work?
00:38 array of string values is passed to the BubbleSort procedure
00:52 dimension variables
01:47 use LBound to get first row of array
01:59 use UBound to get last row of array
02:10 number of rows
02:31 set the last row to compare
02:37 outer DO loop
02:46 inner FOR loop
02:59 iRow is the current row
03:08 compare values
03:41 increment the swap counter if values swapped
04:23 exit the outer DO loop if no swaps made
04:28 decremented last row by 1
04:35 reset swap counter
05:22 When the code is done, the list is in alphabetical order.
05:44 Thanks for joining me
kind regards,
crystal