![]() |
auto sort
Hi i have a league set up and want to auto sort it as i add the scores, it is
in A2:F9, and i want to sort B3:F9, is there a macro that will do this for me please -- thanks Mike |
auto sort
Mike,
Record a macro do the sort, name it (for example) "SortTable" and then insert the code below into the sheet containing your table by clicking on the sheet tab==view code and copy and paste. Private Sub Worksheet_Change(ByVal Target As Range) Dim isectrng As Range On Error GoTo Wsexit Application.EnableEvents = False Application.ScreenUpdating = False Set isectrng = Range("L:L,N:N") ' <== change to relect range in which scores are placed Set isect = Application.Intersect(Target, isectrng) If Not isect Is Nothing Then SortTable '<== change to your macro name as required End If Wsexit: Application.EnableEvents = True End Sub HTH "Mike" wrote: Hi i have a league set up and want to auto sort it as i add the scores, it is in A2:F9, and i want to sort B3:F9, is there a macro that will do this for me please -- thanks Mike |
auto sort
http://cjoint.com/?gzpLgKMXQY Auto Sort Private Sub Worksheet_Change(ByVal Target As Range) If Target.Column = 1 And Target.Count = 1 Then Range("A2", [B65000]).Sort key1:=[A2] End If End Sub Cordialy JB Mike a écrit : Hi i have a league set up and want to auto sort it as i add the scores, it is in A2:F9, and i want to sort B3:F9, is there a macro that will do this for me please -- thanks Mike |
auto sort
Hi that works great thanks, except it only works if i enter the changes
directly into the league, but the scores are entered on a different sheet which puts the req wins into the league, it doesnt auto sort that way, any ides please -- thanks "Toppers" wrote: Mike, Record a macro do the sort, name it (for example) "SortTable" and then insert the code below into the sheet containing your table by clicking on the sheet tab==view code and copy and paste. Private Sub Worksheet_Change(ByVal Target As Range) Dim isectrng As Range On Error GoTo Wsexit Application.EnableEvents = False Application.ScreenUpdating = False Set isectrng = Range("L:L,N:N") ' <== change to relect range in which scores are placed Set isect = Application.Intersect(Target, isectrng) If Not isect Is Nothing Then SortTable '<== change to your macro name as required End If Wsexit: Application.EnableEvents = True End Sub HTH "Mike" wrote: Hi i have a league set up and want to auto sort it as i add the scores, it is in A2:F9, and i want to sort B3:F9, is there a macro that will do this for me please -- thanks Mike |
All times are GMT +1. The time now is 04:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com