amruthubballi
New Member
- Joined
- Apr 27, 2017
- Messages
- 15
Ihave created points table with net run rate calculator. The Table is as follows.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]TEAM[/TD]
[TD]PLAYED[/TD]
[TD]WINS[/TD]
[TD]LOSE[/TD]
[TD]NO RESULT[/TD]
[TD]NET RUN RATE[/TD]
[TD]POINTS[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]SRH[/TD]
[TD]14[/TD]
[TD]9[/TD]
[TD]5[/TD]
[TD]0[/TD]
[TD]+0.284[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]CSK[/TD]
[TD]14[/TD]
[TD]9[/TD]
[TD]5[/TD]
[TD]0[/TD]
[TD]+0.253[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]KKR[/TD]
[TD]14[/TD]
[TD]8[/TD]
[TD]6[/TD]
[TD]0[/TD]
[TD]-0.070[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]RR[/TD]
[TD]14[/TD]
[TD]7[/TD]
[TD]7[/TD]
[TD]0[/TD]
[TD]-0.250[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]MI[/TD]
[TD]14[/TD]
[TD]6[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]+0.317[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]RCB[/TD]
[TD]14[/TD]
[TD]6[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]+0.129[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]KXIP[/TD]
[TD]14[/TD]
[TD]6[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]-0.502[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DD[/TD]
[TD]14[/TD]
[TD]5[/TD]
[TD]9[/TD]
[TD]0[/TD]
[TD]-0.222[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]
I want tosort the table automatically when I updated score in other cells (which islinked to points table) i.e whenever worksheet changes.
I want tosort all simultaneously
1) in descending of points (Team havingmore points should be first)
2) in descending of wins (if teamshaving same points then team having most no of wins should be first)
3) in descending of net run rate ( Ifteam has same points and same wins then team having high net run rate should befirst.
I have writtenfollowing code but it has error I m not understanding to fully automate theprocess.
Private SubWorksheet_Change(ByVal Target As Range)
Subsortonmorethan3cols()
Range("M4:S12").CurrentRegion.SortKey1:=Range("S4"), order1:=xlDescending, Header:=xlYes,Key2:=Range("O4"), order2:=xlDescending, Header:=xlYes,Key3:=Range("R4"), order3:=xlDescending, Header:=xlYes
End Sub
End Sub
I HOPE SOME ONE WILL HELP ME TO RESOLVE THIS....
Thank You
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]M[/TD]
[TD]N[/TD]
[TD]O[/TD]
[TD]P[/TD]
[TD]Q[/TD]
[TD]R[/TD]
[TD]S[/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]TEAM[/TD]
[TD]PLAYED[/TD]
[TD]WINS[/TD]
[TD]LOSE[/TD]
[TD]NO RESULT[/TD]
[TD]NET RUN RATE[/TD]
[TD]POINTS[/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]SRH[/TD]
[TD]14[/TD]
[TD]9[/TD]
[TD]5[/TD]
[TD]0[/TD]
[TD]+0.284[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]6[/TD]
[TD]CSK[/TD]
[TD]14[/TD]
[TD]9[/TD]
[TD]5[/TD]
[TD]0[/TD]
[TD]+0.253[/TD]
[TD]18[/TD]
[/TR]
[TR]
[TD]7[/TD]
[TD]KKR[/TD]
[TD]14[/TD]
[TD]8[/TD]
[TD]6[/TD]
[TD]0[/TD]
[TD]-0.070[/TD]
[TD]16[/TD]
[/TR]
[TR]
[TD]8[/TD]
[TD]RR[/TD]
[TD]14[/TD]
[TD]7[/TD]
[TD]7[/TD]
[TD]0[/TD]
[TD]-0.250[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]9[/TD]
[TD]MI[/TD]
[TD]14[/TD]
[TD]6[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]+0.317[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]RCB[/TD]
[TD]14[/TD]
[TD]6[/TD]
[TD]6[/TD]
[TD]2[/TD]
[TD]+0.129[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]11[/TD]
[TD]KXIP[/TD]
[TD]14[/TD]
[TD]6[/TD]
[TD]8[/TD]
[TD]0[/TD]
[TD]-0.502[/TD]
[TD]12[/TD]
[/TR]
[TR]
[TD]12[/TD]
[TD]DD[/TD]
[TD]14[/TD]
[TD]5[/TD]
[TD]9[/TD]
[TD]0[/TD]
[TD]-0.222[/TD]
[TD]8[/TD]
[/TR]
</tbody>[/TABLE]
I want tosort the table automatically when I updated score in other cells (which islinked to points table) i.e whenever worksheet changes.
I want tosort all simultaneously
1) in descending of points (Team havingmore points should be first)
2) in descending of wins (if teamshaving same points then team having most no of wins should be first)
3) in descending of net run rate ( Ifteam has same points and same wins then team having high net run rate should befirst.
I have writtenfollowing code but it has error I m not understanding to fully automate theprocess.
Private SubWorksheet_Change(ByVal Target As Range)
Subsortonmorethan3cols()
Range("M4:S12").CurrentRegion.SortKey1:=Range("S4"), order1:=xlDescending, Header:=xlYes,Key2:=Range("O4"), order2:=xlDescending, Header:=xlYes,Key3:=Range("R4"), order3:=xlDescending, Header:=xlYes
End Sub
End Sub
I REQUEST YOU
TO PLEASE HELP ME TO WRITE THE VBA CODE I HOPE SOME ONE WILL HELP ME TO RESOLVE THIS....
Thank You