Is there a command called Bubblesort? If so what can it do and its functions
like multiple rows, sort a range by ascendind or descending.
John Walkenbach's "Excel 2003 Power Programming with VBA" (and
probably the 2007 version as well) has an interesting table comparing
various sorting algorithms. As an example of the sort of inefficiency
that Sam Wilson describes, Walkenbach ran a test where it took
bubblesort 329.24 seconds to sort a randomly generated list of 50,000
numbers but took another algorithm called quicksort only 0.27 seconds
to sort the same list. If it is ranges that you want to sort then
Peter T's suggestion of turning on the macro recorder when using
Excel's built-in Data/sort is the way to go. Even if you want to sort
VBA arrays a practical way is to first transfer the data into a
worksheet, sort it there, and transfer it back to an array. Despite
all of the data transfer going on this still outperforms boublesort
except for the smallest arrays and is almost as efficient as
quicksort. See Walkenbach for more details.
Hope that helps
-John Coleman