+ Reply to Thread
Results 1 to 6 of 6

Macro for autosorting a competition ladder

  1. #1
    Registered User
    Join Date
    02-01-2014
    Location
    NSW, Australia
    MS-Off Ver
    Excel 2013
    Posts
    3

    Macro for autosorting a competition ladder

    Hi all, first post. I have little experience in Excel and recently I've started working on a few fun projects to improve my skills.

    I have created a competition table for a sporting a competition. The table has various column headers but of most importance is F/A & Points. The data to be sorted is in K6:T21 (Column S contains F/A, T contains Points) and the column headers are in row 5 (K5, L5,...,T5). It is to be sorted firstly by Points descending then F/A descending, like competition tables commonly are. I want it to autosort if any of the values in F/A or Points change.

    I also have two other competition tables that are Home and Away competition ladders that I would like to be autosorted in the same way. Would it be easier to create a new macro for each or possible to include in the one macro?

    Finally, if I also have a macro for manually sorting the tables by other columns (such as Wins, Losses, For, Against, etc), will this cause issues with the autosort macro?

    I have searched for solutions elsewhere but seeing as I have no experience in VBA I couldn't really follow the other solutions to similar problems and alter them to suit my specific problem.

    If necessary, I can upload a copy of the sheet.

    Any help would be greatly appreciated.

    Edit: Worksheet added

    NRLLadderPredictor.xlsm
    Last edited by Apey; 02-02-2014 at 03:18 AM. Reason: Worksheet added

  2. #2
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Macro for autosorting a competition ladder

    Hello Apey,

    Welcome to the forums

    It is always a huge bonus (that is it generally means someone will quickly look at your problem) if you always include a sample work book with enough data to be meaningful in terms of your request and if appropriate your expected results (in this the text is pretty clear on results expected.

    So, post a sample and the forum members will have a crack at assisting you

    Cheers

    Jmac1947

    1. Please consider clicking on the * Add Reputation if you think this post has helped you
    2. Mark your thread as SOLVED when question is resolved

  3. #3
    Registered User
    Join Date
    02-01-2014
    Location
    NSW, Australia
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Macro for autosorting a competition ladder

    Quote Originally Posted by jmac1947 View Post
    Hello Apey,

    Welcome to the forums

    It is always a huge bonus (that is it generally means someone will quickly look at your problem) if you always include a sample work book with enough data to be meaningful in terms of your request and if appropriate your expected results (in this the text is pretty clear on results expected.

    So, post a sample and the forum members will have a crack at assisting you
    Yeah fair enough, I was being a bit lazy not uploading it haha.

    I'll edit it into the first post to make it easier to read the problem in its entirety

    Just to add, the ladder is generated as the scores are entered. Nothing in the table is altered directly.
    Attached Files Attached Files
    Last edited by Apey; 02-02-2014 at 03:50 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Macro for autosorting a competition ladder

    Hi Apey,

    Given that the ladder is not much use until the round has been completed it may be easier to simply put a "sort button" on the page and use a "normal macro" rather than try to trap a change behind the actual page automatically.

    The auto change can be done but beware it will trigger (generally speaking) if any cell changes, not just the ones you are interested in.

    Just a random thought

    Jmac

  5. #5
    Registered User
    Join Date
    02-01-2014
    Location
    NSW, Australia
    MS-Off Ver
    Excel 2013
    Posts
    3

    Re: Macro for autosorting a competition ladder

    Quote Originally Posted by jmac1947 View Post
    Hi Apey,

    Given that the ladder is not much use until the round has been completed it may be easier to simply put a "sort button" on the page and use a "normal macro" rather than try to trap a change behind the actual page automatically.

    The auto change can be done but beware it will trigger (generally speaking) if any cell changes, not just the ones you are interested in.

    Just a random thought

    Jmac
    Thanks for the reply.

    There are two reasons I want it to sort after any cell changes.

    1) The official ladder for this competition is updated after every single game, so I would prefer it do the same.

    2) This project is also going to double as a 'ladder predictor' whereby people can add games and see the table change as games are entered.

    However, if what you're saying is, having this inbuilt 'autosort' macro is going to play havoc with having a manual sort for individual columns such as For, Against and F/A, then I understand where you're coming from. You said that the auto change will trigger if any cell changes - does it also trigger from a regular sort action?

  6. #6
    Valued Forum Contributor
    Join Date
    01-19-2010
    Location
    Melbourne Australia
    MS-Off Ver
    latest is Excel 2016. have older versions
    Posts
    624

    Re: Macro for autosorting a competition ladder

    to be honest I don't know the answer to your question, I am reasonably new to the amazing world of "worksheet_events" processing.

    My gut guess is that it will usually do that so you would need to be specific about which cells changing should be processed and which ones are to effectively be ignored.

    I will try to get some time tomorrow to have a play

    Jmac

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. AutoSorting Help
    By DebraAnne1981 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-10-2013, 03:22 PM
  2. Autosorting & Resetting Macro
    By ASHMANT in forum Excel General
    Replies: 0
    Last Post: 03-12-2012, 03:25 PM
  3. Competition Ladder: All Stats Equal
    By DRAGONZ_RULE in forum Excel General
    Replies: 1
    Last Post: 03-16-2011, 09:25 PM
  4. AutoSorting
    By OlYeller21 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2006, 03:22 PM
  5. Autosorting Information
    By Rosc076 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 06-27-2006, 03:15 PM

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1