Results 1 to 4 of 4

Thread: Automatic sort and update league table in Excel

  1. #1
    Join Date
    Dec 2011
    Posts
    61

    Automatic sort and update league table in Excel

    I'm just getting up to speed with Excel and as an exercise I'm trying to implement a simple league table. What I'd like to know is how to create 'dynamically' a ranking table like the one shown below.
    Pos || Player ||Points
    1 Tom 124
    2 Linda 122
    3 Harry 107
    4 Jayne 100
    4 Bob 100
    5 Steve 89
    6 Mark 88
    7 John 80
    8 Angie 77
    9 Andrew 71

    The table is sorted on the points column, the values for which are referenced from another sheet. Ideally I'd Like the table to be sorted automatically as players points total change (based on calculations in another sheet). Can I do this with formulas/macros or will it require some VBA code? So if you guys have any information then please let me know.

  2. #2
    Join Date
    May 2011
    Posts
    523

    Re: Automatic sort and update league table in Excel

    You can do this with a worksheet change macro in the sheet module.
    So for that just Right click on the sheet tab>view code>left window use worksheet>right window select and write your code to sort.

  3. #3
    Join Date
    May 2011
    Posts
    448

    Re: Automatic sort and update league table in Excel

    I think you have to make the use of these macros may this will work for sort and update league table

    Code:
    Private Sub Worksheet_Calculate()
    With Me
    .Columns("A:B").Sort Key1:=Range("B2"), _
    Order1:=xlDescending, _
    Key2:=Range("A2"), _
    Order2:=xlAscending, _
    Header:=xlYes
    End With
    End Sub
    'This is worksheet event code, which means that it needs to be placed in the appropriate worksheet code module, not a standard code module. To do this, right-click on the sheet tab, select the View Code option from the menu, and paste the code in.

  4. #4
    Join Date
    Jul 2011
    Posts
    640

    Re: Automatic sort and update league table in Excel

    Maybe best to stop the cascade of events, you can also try this one also.

    Code:
    Private Sub Worksheet_Calculate()
    Application.EnableEvents = False
    With Me
    .Columns("A:B").Sort Key1:=Range("B2"), _
    Order1:=xlDescending, _
    Key2:=Range("A2"), _
    Order2:=xlAscending, _
    Header:=xlYes
    End With
    Application.EnableEvents = True
    End Sub

Similar Threads

  1. How to sort multiple columns in Excel Pivot Table
    By Nicoloid in forum MS Office Support
    Replies: 2
    Last Post: 17-02-2012, 08:01 PM
  2. Replies: 2
    Last Post: 24-01-2012, 02:07 PM
  3. How to Automatic update the date in Microsoft Excel
    By Raju Chacha in forum MS Office Support
    Replies: 1
    Last Post: 14-01-2012, 02:57 PM
  4. How to automatically update excel table in word
    By Savannah87 in forum Windows Software
    Replies: 5
    Last Post: 20-03-2010, 01:39 AM
  5. Sort a table for several classes
    By New ID in forum Software Development
    Replies: 5
    Last Post: 13-02-2010, 04:19 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,002,826.40643 seconds with 17 queries