I've inherited a spreadsheet to maintain and I've little clue what I'm doing with Macros!
The table that is sorting is a league table, and to sort by average points, the div/o is above those with 0 (the div/o need to be bottom)
The results are taken from another tab via a vlookup to the setting tab (where I have used an =if(iserror) to put points at -1 for div/0
(column order)
B C D E F G H I J H AB
# Team Pl W D L F A GD PTS Average Points
1 #LoveCurlingFC 2 2 0 0 78 3 75 6 3.0
2 AC Dead People 0 0 0 0 0 0 0 0 0.0
3 AC Rotery 0 0 0 0 0 0 0 0 0.0
4 2 Bangs 1 0 0 1 1 3 -2 0 0.0
5 2 Goals 1 0 0 1 2 75 -73 0 0.0
I want to sort on H, then AB, then J. I've copied the VBA below - can anyone help?
![]()
Sub Sort() ' ' Sort Macro ' ' Keyboard Shortcut: Ctrl+Shift+S ' Range("B4:AC305").Select ActiveWindow.ScrollRow = 79 ActiveWindow.ScrollRow = 76 ActiveWindow.ScrollRow = 73 ActiveWindow.ScrollRow = 68 ActiveWindow.ScrollRow = 64 ActiveWindow.ScrollRow = 59 ActiveWindow.ScrollRow = 53 ActiveWindow.ScrollRow = 47 ActiveWindow.ScrollRow = 41 ActiveWindow.ScrollRow = 34 ActiveWindow.ScrollRow = 29 ActiveWindow.ScrollRow = 27 ActiveWindow.ScrollRow = 22 ActiveWindow.ScrollRow = 15 ActiveWindow.ScrollRow = 8 ActiveWindow.ScrollRow = 1 ActiveWorkbook.Worksheets("League Table").Sort.SortFields.Clear ActiveWorkbook.Worksheets("League Table").Sort.SortFields.Add Key:=Range( _ "ab6:ab305"), SortOn:=xlSortOnValues, Order:=xlDescending, DataOption:= _ xlSortNormal With ActiveWorkbook.Worksheets("League Table").Sort .SetRange Range("B5:AC305") .Header = xlYes .MatchCase = False .Orientation = xlTopToBottom .SortMethod = xlPinYin .Apply End With End Sub











LinkBack URL
About LinkBacks
Register To Reply
Bookmarks