Hi all,
tried the following to sort the excel table but all Total column does is flash ( in a millisecond) and then immediately reverts to original order and the Names in the name column move around to different cells in the column and if you run code again names move around in the name column, any ideas where i might be messing up.
First time using tables for this stuff rather than sheets and ranges
tried the following to sort the excel table but all Total column does is flash ( in a millisecond) and then immediately reverts to original order and the Names in the name column move around to different cells in the column and if you run code again names move around in the name column, any ideas where i might be messing up.
First time using tables for this stuff rather than sheets and ranges
VBA Code:
Sub Sort()
Dim ws As Worksheet
Set ws = ActiveSheet
With ws.ListObjects("LB_1").Sort
.SortFields.Clear
.SortFields.Add Key:=Range("LB_1[Total]"), Order:=1
.Header = xlYes
.Apply
End With
End Sub
Rollover API source 2026(1).xlsm | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | S | |||||
1 | Position | Entry No. | Name | Total | Total +/- Bonus | Jul | Aug | Sept | Oct | Nov | Dec | Jan | Feb | Mar | Apr | May | GD | ||||
2 | 1 | 1 | Jim | 844 | 864 | 0 | 99 | 87 | 123 | 81 | 132 | 114 | 113 | 95 | 0 | 0 | 102 | ||||
3 | 2 | 2 | Andy | 821 | 834 | 0 | 95 | 78 | 115 | 93 | 115 | 112 | 108 | 105 | 0 | 0 | 60 | ||||
4 | 3 | 3 | Frank | 771 | 767 | 0 | 80 | 80 | 111 | 73 | 140 | 104 | 85 | 98 | 0 | 0 | 14 | ||||
5 | 4 | 4 | Terry | 750 | 746 | 0 | 81 | 87 | 108 | 62 | 117 | 109 | 89 | 97 | 0 | 0 | -63 | ||||
6 | 5 | 5 | Joe | 801 | 804 | 0 | 87 | 93 | 93 | 66 | 147 | 115 | 105 | 95 | 0 | 0 | 57 | ||||
Sheet1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2:A6 | A2 | =IF(C2<>"",COUNTA($C$2:C2),"") |
B2:B6 | B2 | =Pt_By_Lg[@[Entry No.]] |
D2:D6 | D2 | =Pt_By_Lg[@Total] |
E2:E6 | E2 | =Pt_By_Lg[@[Total +/- Bonus]] |
F2:F6 | F2 | =IF(C2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Jul]))) |
G2:G6 | G2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Aug]))) |
H2:H6 | H2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Sept]))) |
I2:I6 | I2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Oct]))) |
J2:J6 | J2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Nov]))) |
K2:K6 | K2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Dec]))) |
L2:L6 | L2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Jan]))) |
M2:M6 | M2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Feb]))) |
N2:N6 | N2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Mar]))) |
O2:O6 | O2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[Apr]))) |
P2:P6 | P2 | =IF($C$2="","",SUMPRODUCT(SUMIF(TablesAll[Team],Name[@[Premier1]:[League 2.4]],Month[May]))) |
S2:S6 | S2 | =Pt_By_Lg[@GD] |
Cells with Conditional Formatting | ||||
---|---|---|---|---|
Cell | Condition | Cell Format | Stop If True | |
I3:I6 | Cell Value | top 1 values | text | NO |
F2:F6 | Cell Value | top 1 values | text | NO |
G2:G6,H2:P2,O3:P6 | Cell Value | top 1 values | text | NO |
H3:H6 | Cell Value | top 1 values | text | NO |
J3:J6 | Cell Value | top 1 values | text | NO |
K3:K6 | Cell Value | top 1 values | text | NO |
L3:L6 | Cell Value | top 1 values | text | NO |
M3:M6 | Cell Value | top 1 values | text | NO |
N3:N6 | Cell Value | top 1 values | text | NO |