it could be done with a formula I think, but is probably easiest to do with a sort macro
convert all your formulas from relative to absolute references, then try these macros
you will need to adjust the sort range and sort key to reflect the data you want to sort on
Sub sort_ascending()
Dim SortRange, SortKey
SortRange = "A4:D6" 'range of data to sort
SortKey = "A4" 'cell to sort on
ActiveWorkbook.Worksheets("LEADERBOARD").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("LEADERBOARD").Sort.SortFields.Add Key:=Range(SortKey), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("LEADERBOARD").Sort
.SetRange Range(SortRange)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Sub sort_descending()
Dim SortRange, SortKey
SortRange = "A4:D6" 'range of data to sort
SortKey = "A4" 'cell to sort on
ActiveWorkbook.Worksheets("LEADERBOARD").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("LEADERBOARD").Sort.SortFields.Add Key:=Range(SortKey), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("LEADERBOARD").Sort
.SetRange Range(SortRange)
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks