You want to use a shell or bubble sort. A shell sort will be faster but a bubble sort is easier to code. I in all honesty forget how to do them but you can easily figure out how to do them. Basically A bubble sort works like this.
words: Cat, Dog, Apple, Justice, Health, Gatorade
It will compare Cat and Dog first
Cat vs. Dog no change cat starts with a c and c comes before d
Cat, Dog, Apple, Justice, Health, Gatorade
next dog vs. apple change a comes before d
Cat, Apple, Dog, Justice, Health, Gatorade
next dog vs. justice no change d comes before j
Cat, Apple, Dog, Justice, Health, Gatorade
next justice vs. health change h comes before j
Cat, Apple, Dog, Health, justice, Gatorade
next justice vs gatorade change g comes before j
Cat, Apple, Dog, Health, Gatorade, justice
And so on until the order no longer has any changes. It will go through the list more than once (assuming nothing is in correct order)
I forget the logic on shell sort but it has something to do with splitting everything in half.
http://en.wikipedia.org/wiki/Bubble_sort
http://en.wikipedia.org/wiki/Shell_sort
Sorry about forgetting the algorithms to these but I haven't used QB in almost 4 months now but I hope this helps you to get started.