I need to sort a three dim array I have the code for a two but an unser how to edit it. <BR><BR>Sub DualSorter( byRef arrArray, DimensionToSort )<BR> Dim i, x, smallest_value, smallest_key, rememberkey, rememberval, _<BR> swap_pos, OtherDimension<BR> Const column = 1<BR> <BR> If DimensionToSort = 1 then<BR> OtherDimension = 0<BR> ElseIf DimensionToSort = 0 then<BR> OtherDimension = 1<BR> Else<BR> &#039;Shoot, invalid value of DimensionToSort<BR> Response.Write "Invalid dimension for DimensionToSort: " & _<BR> "must be value of 1 or 0."<BR> Response.End<BR> End If<BR> <BR> For i = 0 To UBound( arrArray, column ) - 1<BR> &#039;Start outer loop.<BR> <BR> &#039;Take a snapshot of the first element<BR> &#039;in the array because if there is a <BR> &#039;smaller value elsewhere in the array <BR> &#039;we&#039;ll need to do a swap.<BR> smallest_value = arrArray ( i, DimensionToSort )<BR> rememberkey = arrArray ( i, OtherDimension )<BR> rememberval = arrArray ( i, DimensionToSort )<BR> swap_pos = i<BR> <BR> For x = i + 1 to UBound( arrArray, column )<BR> &#039;Start inner loop.<BR> If arrArray ( x, DimensionToSort ) &#062; smallest_value Then<BR> &#039;This is now the lowest number - <BR> &#039;remember it&#039;s position.<BR> swap_pos = x<BR> smallest_value = arrArray ( x, DimensionToSort )<BR> smallest_key = arrArray ( x, OtherDimension )<BR> End If<BR> Next<BR> <BR> If swap_pos &#060;&#062; i Then<BR> &#039;If we get here then we are about to do a swap<BR> &#039;within the array.<BR> arrArray ( swap_pos, OtherDimension ) = rememberkey<BR> arrArray ( swap_pos, DimensionToSort ) = rememberval<BR> arrArray ( i, OtherDimension ) = smallest_key<BR> arrArray ( i, DimensionToSort ) = smallest_value<BR> End If <BR> Next<BR>End Sub