Problem with Sort

HuaMin Chen
HuaMin Chen used Ask the Experts™
on
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?
1e.png
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Distinguished Expert 2017

Commented:
Look for a leading space.
HuaMin ChenProblem resolver

Author

Commented:
There is no leading space within cell B2.
HuaMin ChenProblem resolver

Author

Commented:
Sorry, it should be Cell B1.
HuaMin ChenProblem resolver

Author

Commented:
Which is the 2nd cell, being highlighted in above.
Commented:
It looks like you have
        .Header = xlYes
while not having any headers. That would explain it

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial