Even mine was even backwards. The script he redid is totally upside down. He had the column position for a row position. This one below works.<BR><BR><%@ Language="VBScript" %><BR><%<BR><BR>'== This entire piece of code was shamelessly stolen from<BR>'== the 4 Guys From Rolla WebWeekly newsletter, translated<BR>'== to VBScript and changed into server-side ASP code.<BR>'== Every effort has been made to keep comments intact.<BR><BR><BR><BR>Response.Write "<HTML><HEAD></HEAD><BODY BGCOLOR=""WHITE"">"<BR><BR>Sub QuickSort(vec,loBound,hiBound,numRows)<BR> Dim pivot,loSwap,hiSwap,temp<BR><BR> '== This procedure is adapted from the algorithm given in:<BR> '== Data Abstractions & Structures using C++ by<BR> '== Mark Headington and David Riley, pg. 586<BR> '== Quicksort is the fastest array sorting routine for<BR> '== unordered arrays. Its big O is n log n<BR><BR><BR> '== Two items to sort<BR> if hiBound - loBound = 1 then<BR> if vec(0,loBound) > vec(0,hiBound) then<BR><BR> for rowcount=0 to numRows<BR> temp=vec(rowcount,loBound)<BR> vec(rowcount,loBound) = vec(rowcount,hiBound)<BR> vec(rowcount,hiBound) = temp<BR> next<BR><BR> End If<BR> End If<BR><BR> '== Three or more items to sort<BR><BR> redim pivot(numRows+1)<BR> for rowcount=0 to numRows<BR> pivot(rowcount) = vec(rowcount,int((loBound + hiBound) / 2))<BR> vec(rowcount,int((loBound + hiBound) / 2)) = vec(rowcount,loBound)<BR> vec(rowcount,loBound) = pivot(rowcount)<BR> next<BR><BR> loSwap = loBound + 1<BR> hiSwap = hiBound<BR><BR> do<BR> '== Find the right loSwap<BR> while loSwap < hiSwap and vec(0,loSwap) <= pivot(0)<BR> loSwap = loSwap + 1<BR> wend<BR> '== Find the right hiSwap<BR> while vec(0,hiSwap) > pivot(0)<BR> hiSwap = hiSwap - 1<BR> wend<BR> '== Swap values if loSwap is less then hiSwap<BR> if loSwap < hiSwap then<BR> for rowcount=0 to numRows<BR> temp = vec(rowcount,loSwap)<BR> vec(rowcount,loSwap) = vec(rowcount,hiSwap)<BR> vec(rowcount,hiSwap) = temp<BR> next<BR> End If<BR> loop while loSwap < hiSwap<BR><BR>for rowcount=0 to numRows<BR> vec(rowcount,loBound) = vec(rowcount,hiSwap)<BR> vec(rowcount,hiSwap) = pivot(rowcount)<BR>next<BR><BR><BR><BR><BR> '== Recursively call function .. the beauty of Quicksort<BR> '== 2 or more items in first section<BR> if loBound < (hiSwap - 1) then Call QuickSort(vec,loBound,hiSwap-1,numRows)<BR> '== 2 or more items in second section<BR> if hiSwap + 1 < hibound then Call QuickSort(vec,hiSwap+1,hiBound,numRows)<BR><BR>End Sub 'QuickSort<BR><BR>Sub PrintArray(vec,lo,hi)<BR> '== Simply print out an array from the lo bound to the hi bound.<BR> Response.Write "<strong>col1 col2 col3</strong><BR>"<BR> Dim i<BR> For i = lo to hi<BR> Response.Write "<i>"&vec(0,i) & "</i> " & vec(1,i) & " " & vec(2,i) & "<BR>"<BR> Next<BR>End Sub 'PrintArray<BR><BR><BR>Randomize<BR><BR>Di m x(3,3)<BR><BR>For z = 0 to 2<BR> x(0,z) = int(Rnd*1000)<BR> x(1,z) = "test"&z<BR> x(2,z) = "test-"&z<BR> If (Rnd < 0.5) then x(0,z) = x(0,z)-1000<BR>Next<BR><BR>Response.Write "Here is a jumbled array:<BR>"<BR>Call PrintArray(x,0,2)<BR><BR>Call QuickSort(x,0,2,2)<BR><BR>Response.Write "Now the array is sorted!</BR>"<BR>Call PrintArray(x,0,2)<BR><BR>Response.Write "</BODY></HTML>"<BR>%>