View Single Post
 
Old 12-13-2006, 08:43 PM
Adrian's Avatar
Adrian Adrian is offline
Senior Member
It's my post
 
Join Date: 31 Oct 2002
Location: Wisconsin, USA
Age: 35
Gender: male
Posts: 4,805
Default

If you could help out, that's great.

I got a modification of my code (a bubble sort that sorts a one-dimensional array) which now sorts a two dimensional array. The problem is, it doesn't work. I barely understand bubble sorts as it is, and I can't figure out why the second one won't sort. Here's the code:

Code:
 
Public Function SortArrayOfZips(location() As Variant) As Variant()
    Dim First As Integer, Last As Integer
    Dim i As Integer, j As Integer
    Dim Temp As String
    
    First = LBound(location)
    Last = UBound(location)
    
For i = First To Last
For j = First To (Last - i - 1)
If location(j, First) > location(j + 1, First) Then
Temp = location(j, 1)
location(j, 1) = location(j + 1, 1)
location(j + 1, 1) = Temp
End If
Next j
Next i
    
SortArrayOfZips = location()
End Function
Thanks much in advance!

Adrian
__________________


What Part Of My Body Hurts The Most
What part of my soul is crying
For crying out loud
What part of my heart is beating
Faster than the speed of love
Is this the way that it's supposed to be
What Part Of My Body Hurts The Most
Come a little bit closer
Come here now
Let's see
Reply With Quote