I recorded some code using Excel 2010 and would like that same code to work in both Excel 2003 and 2010 (see code below). I currently get an error when I run this code in 2003 but not 2010. I know recording is not best practice but can someone help me convert what seems to be a pretty simple "sort a range type of code".

Thanks,

D

Application.Goto Reference:="mainsort"
    ActiveWorkbook.Worksheets("Sum").Sort.SortFields.Clear
    ActiveWorkbook.Worksheets("Sum").Sort.SortFields.Add Key:=Range("B7:B57"), _
        SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
    With ActiveWorkbook.Worksheets("Sum").Sort
        .SetRange Range("A6:J57")
        .Header = xlYes
        .MatchCase = False
        .Orientation = xlTopToBottom
        .SortMethod = xlPinYin
        .Apply
    End With