String Comparison Not Returning Expected Result

P

(PeteCresswell)

The comparison is coded thusly:
-------------------------------------------------------------
If .Cells(rowNum_FirstData, mySortCol).Value _
< .Cells(rowNum_LastData_Revised, mySortCol).Value Then...
-------------------------------------------------------------


But it's case-sensitive.

To wit:
------------------------------------------------
?("aaa" < "zzz")
True

?("aaa" < "Zzz")
False

?("aaa, ABN AMRO Bank" < "Yorktown Capital LLC")
False
------------------------------------------------


Basically, I want to determine whether a column is in ascending
or descending order so I can sort it to the opposite order.

My kneejerk is to Dim a couple of strings, uCase the values
in question into them, and then do the comparison on
the Dim-d strings.

Is there a good-right-and-holy path to follow here?
 
P

(PeteCresswell)

Per Joel:
If your sort command ignores case then do this
?(ucase("aaa") < ucase("zzz"))

Sounds like maybe there's a Sort command argument to tell it
whether or not to consider case.

I'll take a look.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top