Sort data based on values, in descending order

  • Hi All, so i have an issue with my code. when i am on the tab 'supplier data' my code works fine. however when i insert this macro in to my overall macro that runs 8+ macros using 'call' it no longer works.


    i suspect its because i'm using the 'select' function, but i'm not smart enough to figure out how to fix it!


    many thanks as always for your assistance guys

  • code below:


    Worksheets("Supplierdata").Range("P2:R200").Select

    Worksheets("Supplierdata").Sort.SortFields.Clear

    Worksheets("Supplierdata").Sort.SortFields.Add Key:=Range( _

    "R3:R200"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _

    xlSortNormal

    With Worksheets("Supplierdata").Sort

    .SetRange Range("P2:R200")

    .Header = xlYes

    .MatchCase = False

    .Orientation = xlTopToBottom

    .SortMethod = xlPinYin

    .Apply

    End With

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!