View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
RB Smissaert RB Smissaert is offline
external usenet poster
 
Posts: 2,452
Default Syntax Laurent Longre's Morefunc VSORT with arrays?

Come across some problems with this.
Firstly, it doesn't seem to like columns with non-integer numeric data,
causing a type mismatch
error.
Secondly, it seems to change the base of the array from 0-bound to 1-bound
I could convert the base back with one of Alan Beban's array functions, but
not sure if there is then
much speed gain left.
This is a pity as it is otherwise nice and fast and simple.
Any advice about this?

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