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
Microsoft ExcelVisual Basic ClassicVB ScriptVBAMicrosoft Access

Avatar of undefined
Last Comment
Simulog
Avatar of PatHartman
PatHartman
Flag of United States of America image

Look for a leading space.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

There is no leading space within cell B2.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Sorry, it should be Cell B1.
Avatar of Peter Chan
Peter Chan
Flag of Hong Kong image

ASKER

Which is the 2nd cell, being highlighted in above.
ASKER CERTIFIED SOLUTION
Avatar of Simulog
Simulog
Flag of Sweden image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Microsoft Access
Microsoft Access

Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.

226K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo