View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Alan Beban Alan Beban is offline
external usenet poster
 
Posts: 200
Default alphabetically sorting an array

Albert wrote:
Yes sir, it works fine, except for some strange glitch. The sort seems to
consider uppercase and lowercase as different. What to do?
Thanks,
Albert


I don't know whether this response will advance or retard your efforts,
but the following code snippet may suggest an approach for you, or for
someone else who is inclined to help. Or it may prompt someone to
suggest an obvious and simple approach that makes this response seem silly.

In any event, the code snippet below is from a function that has an
optional Boolean parameter, "Match Case", whose default value is False.
I believe that if similar such snippets were sprinkled into Tom
Ogilvey's code at appropriate places, the sort could be case sensitive
or not, as desired, but I'm not currently up to studying my old code to
figure it out.

If you were to download the freely downloadable file at
http://home.pacbell.net/beban and scroll through the functions in it by
finding the term "MatchCase", you might get a feel for how to apply such
a snippet.

For i = LBound(arr) To UBound(arr)
If MatchCase Then
If arr(i, FilterColumn) < FilterValue Then
outputArrayRFilter(w) = RowVector(arr, i)
w = w + 1
End If
Else
If StrComp(arr(i, FilterColumn), FilterValue, vbTextCompare) < 0 Then
outputArrayRFilter(w) = RowVector(arr, i)
w = w + 1
End If
End If
Next

Alan Beban