PDA

View Full Version : Basic Sorting Question (non Array)



Bahester
10-17-2010, 07:01 PM
I'm fairly new to programming and VBA overall but I basically have to make a sorting algorithm that can sort a bunch of random numbers from lowest to highest. I know it's a lot easier to do this using an array or the .sort function but I'm required to use 2 loops so that at the end I can "animate" and watch the sorting actually happen.

My brain is fried from trying to figure this out. All I've got so far is:

a = Range("b2").Offset(1, 0).Value

With Worksheets("linesort")
countCell = Range("SortedLine").Count
End With

For i = 1 To countCell - 1
lowest = a
For j = 1 To countCell - 1

Any help would be greatly appreciated :dunno

macropod
10-17-2010, 08:18 PM
Hi bahester,

I'm required to use 2 loops
Sounds like homework to me. I don't do homework ...

Bahester
10-17-2010, 08:36 PM
No big deal, thanks anyways. Was able to sit down with a pencil and paper and try to do a few flow charts and I think I'm headed in the general direction. Still stumped, but still trying :P

mbarron
10-17-2010, 08:38 PM
Sounds like you should do a search on 'bubble sort'