## ArrSort_2Arr

Sort 2 1-dimension arrays
Actually sort 1st array (Array1) based on values ascending or descending, then change items in Array2 to match order in Array1
Sort can be in Ascending or Descending order.
Not like sortArray, this one involves two arrays, and can decide order

Function ArrSort_2Arr(arrShort, byRef arrSub, Order_1Asc_2Desc)
Ord1    = 1
If Order_1Asc_2Desc = 2 Then Ord1 = 2
for i = UBound(arrShort) - 1 To 0 Step -1
for j= 0 to i
Cond1 = arrShort(j) > arrShort(j+1)
If Ord1 = 2 Then Cond1 = arrShort(j) < arrShort(j+1)
If Cond1 Then
temp   = arrShort(j+1)
temp1   = arrSub(j+1)
arrSub(j+1) = arrSub(j)
arrSub(j)  = temp1
arrShort(j+1) = arrShort(j)
arrShort(j) = temp
end if
next
next
ArrSort_2Arr   = arrShort
End Function
arrShort, byRef arrSub, Order_1Asc_2Desc
Sort A2 ascending into A3, then re-order items in A1 according to new list<br/>A3 = ArrSort_2Arr(A2, A1, 1)<br/><br/>Sort A2 descending into A4, then re-order items in A1 according to new list<br/>A4 = ArrSort_2Arr(A2, A1, 2)<br/>