I have an implementation of QSort on my web site at
http://www.cpearson.com/Excel/QSort.htm . You can download the module
at
http://www.cpearson.com/zips/modQSortInPlace.zip . It handles both
case sensitive and case insensitive sorts in either ascending or
descending order. QSort is much faster than a bubble sort. The code
can handle sorting both strings and numerics and it can handle sorting
only a subset of an array.
You would call QSortInPlace with code like
Sub AAA()
Dim Arr(1 To 5) As String
Dim N As Long
Arr(1) = "z"
Arr(2) = "A"
Arr(3) = "a"
Arr(4) = "Z"
Arr(5) = "m"
QSortInPlace InputArray:=Arr, CompareMode:=vbBinaryCompare
For N = 1 To 5
Debug.Print Arr(N)
Next N
End Sub
Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
On Sun, 14 Mar 2010 17:44:01 -0700, Neal Zimm <(E-Mail Removed)>
wrote:
>Cher Bernard,
> Merci.
> Lcase and Ucase do me no good.
>
> The sort works fine with option compare text, but I wanted "more".
>
> If you need a case sensitive sort, (and I forgot about the ascii
>collating sequence) what's the best way without writing to a worksheet and
>sorting there?
>
>thanks much.
>Neal