This routine will sort a one dimensional array.
Call orderRoutineOneDim(yourArray, [decendingSort]) will sort a one dimensional array. If variable decendingSort is False (default) it will be sorted ascending. If True, decending.
This routine will sort an array dimensioned such that the first index varies, but the second index is always 1 (Dim myARRAY (Low to High, 1 to 1))
orderRoutineTwoDim accepts the same kinds of variables as orderRoutineOneDim.
Both these routines sorted arrays of 10,000 elements in 1 second, 50,000 in 4 sec, and 100,000 in 7 sec.
As is, they sort on "<". If you want a differnet kind of sort (like on the value of strings), you'll have to use the custom LT function. If you are sorting a squarer array, a quick modification of the Range sort in the previous post would probably be best.
These are rather generalized routines. If I had a better picture of what values you are sorting and to what end, we tighten up the code and get the excicution time down.
Bookmarks