Howdy,<BR><BR>Okay, its 1 day until I go on vacation, my mind isn't with it.<BR><BR>I have been playing with the quick sort algorithm in my spare time (based of article on 4guys). I am attempting to sort the <BR>array on based on the 8th column in my VBS Array (its a date that may/may not be there) <BR><BR>All sorting routines seem to run on the first index, not the second, needless to say they are a touch confusing this week, kinda like women all the time to me.<BR><BR>blah,blah.<BR><BR>I will post what code i have so far, its not necessarily finished, but the for loops i marked come out confusing, i guess i shouldn't have drank so much and killed all my data structures brain cells. <BR>Thanks - Analog man in binary business.<BR><BR>'*************************** **************<BR>The Swap function used <BR>'***********************************<BR>S ub SwapRows(ary,row1,row2) <BR>dim p,t<BR> for p = 0 to UBound(ary,1)<BR> t = general(p,row1)<BR> general(p,row1) = general(p,row2)<BR> general(p,row2) = t<BR> next<BR>End Sub 'SwapRows <BR>'*************************************<BR ><BR>'*************************************** **<BR>Sub QuickSort(vec,loBound,hiBound,SortField) <BR>' Parameters: vec - array to be sorted == <BR>' SortField - The field to sort on (2nd dimension value) == <BR><BR> Dim pivot(),loSwap,hiSwap,temp,counter <BR> Redim pivot (Ubound(vec,2)) <BR><BR> '== Two items to sort <BR><BR> if hiBound - loBound = 1 then <BR> if vec(SortField,loBound) > vec(SortField,hiBound) then Call SwapRows(vec,hiBound,loBound) <BR><BR> End If <BR> <BR> ' ********* part i haven't figured out ********<BR> ' ** worst of it is, i knew this stuff once ***<BR> For counter = 0 to Ubound(vec,2) <BR> pivot(counter) = vec(int((loBound + hiBound) / 2),counter) <BR> vec(int((loBound + hiBound) / 2),counter) = vec(loBound,counter) <BR> vec(loBound,counter) = pivot(counter) <BR> Next <BR><BR> loSwap = loBound + 1 <BR> hiSwap = hiBound <BR><BR> do '== Find the right loSwap <BR><BR> while loSwap < hiSwap and vec(SortField,loSwap) <= pivot(loSwap) <BR> loSwap = loSwap + 1 <BR> wend <BR> <BR> while vec(SortField,hiSwap) > pivot(hiSwap) <BR> hiSwap = hiSwap - 1 <BR> wend '== Swap values <BR><BR> if loSwap < hiSwap then Call SwapRows(vec,loSwap,hiSwap) <BR><BR> loop while loSwap < hiSwap <BR><BR> For counter = 0 to Ubound(vec,2) <BR> vec(sortField,loSwap) = vec(sortField,hiSwap) <BR> vec(sortField,hiSwap) = pivot(counter) <BR> Next <BR><BR> if loBound < (hiSwap - 1) then Call QuickSort(vec,loBound,hiSwap-1,SortField) <BR> if hiSwap + 1 < hibound then Call QuickSort(vec,hiSwap+1,hiBound,SortField) <BR>End Sub 'QuickSort <BR><BR>'************************************ *********<BR>Cheers,Skol, etc.