View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Excel sort vs VBA

There are many differences between comparisons in Excel & VBA, particularly
with different data types. However in this particular case to get VBA to
simulate Excel head your module
Option Compare Text

and you should find the result of your test demo is reversed to same as
Excel

But need to do a lot more to fully simulate Excel

Regards,
Peter T


"Glynn Consulting Ltd" wrote
in message ...
The problem is not what the line should say, it is how Excel has sorted

the
line compared to how visual basic regards the data. Excel says one is

greater
than the other, while VBA says that one is less than the other.

To distill the problem to the bare minimum..

In Excel the formula =IF("-""(","Yes","No") gives the result "No"

In VBA the routine...

Sub Test()
If "-" "(" Then
MsgBox "Yes"
Else
MsgBox "No"
End If
End Sub

...gives the result "Yes"



"Norman Jones" wrote:

Hi Glynn,

Perhaps:

Ad Spend - Arbeitsagentur (Group Label)


should be

Ad Spend - Arbeitsagentur - (Group Label)

( missing hyphen ?)