View Single Post
  #6  
Old 11-20-2007, 10:22 PM
Meech Meech is offline
Senior Member
 
Join Date: Nov 2004
Location: Meechigan
Posts: 1,159
Default Re: Anyone good at VB?

I'm a database guy so a simple "SORT BY" or more recently a [img]/images/graemlins/blush.gif[/img]rder=> gets the job done.

But sort 101 is the bubble sort. Here is an example I nabbed off the net. If you need some help adapting it, lemme know.

' Bubble Sort

Dim I, J, IntArray(), Temp as Integer ' Declare Variables

For I = 1 To Length - 1 ' Supposed to be the smaller value
For J = I To Length ' Supposed to be the larger value
If IntArray(I) > IntArray(J) Then ' Compare Cells
Temp = IntArray(I) ' \
IntArray(I) = IntArray(J) ' | Swap Cells
IntArray(J) = Temp ' /
End If
Next
Next


http://en.wikipedia.org/wiki/Bubble_sort
Reply With Quote