Link to home
Start Free TrialLog in
Avatar of Peter Chan
Peter ChanFlag for Hong Kong

asked on

Problem with Sort

Hi,
Having run these
    With Worksheets("Sheet9").Sort
        With .SortFields
            .Clear
            .Add Key:=Range("B1:B1") _
                    , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
        End With
        .SetRange Range("A:D")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With

Open in new window

only the highlighted row is not in proper position (as shown below). Why?
User generated image
Avatar of PatHartman
PatHartman
Flag of United States of America image

Look for a leading space.
Avatar of Peter Chan

ASKER

There is no leading space within cell B2.
Sorry, it should be Cell B1.
Which is the 2nd cell, being highlighted in above.
ASKER CERTIFIED SOLUTION
Avatar of Simulog
Simulog
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial