Syntax Laurent Longre's Morefunc VSORT with arrays?
OK, I understand now.
The key has to be a range or array, just holding the values to sort on.
So if I supply an array to be sorted I have to make another array
holding just the values of the column to sort on.
RBS
"RB Smissaert" wrote in message
...
To make matters it a bit clearer I thought it would be better to start a
new thread about this.
Previous thread was: Fastest way to sort large 2-D arrays?
I am trying to figure out how to use Laurent Longre's VSORT in the .xll
add-in MoreFunc.
The help file makes it clear for ranges, but not for VBA arrays.
Say I have a 10 column array that I want sorted ascending on column 2 and
descending on column 5
what would the syntax be for that?
The only thing that I have got working sofar is this:
Sub Test()
Dim arr(1 To 10000, 1 To 5) As Long
Dim arr2
Dim i As Long
Dim c As Long
For i = 1 To 10000
arr(i, 1) = Int((i * Rnd) + 1)
For c = 2 To 5
arr(i, c) = i
Next
Next
arr2 = Application.Run([VSORT], arr, arr, 0) 'this works
End Sub
This will sort descending on column 1.
Thanks for any advice.
RBS
|