Sort Using Toggle Button

  • Hi All,


    I am trying to use one single toggle button to sort a sheet that can be downloaded HERE. Currently I have to use 2 buttons to do what I want.


    I would like to combine both buttons into one button that changes text based on the 2 sort options. If the sheet is sorted by TEAM (team numbers are on left) the button should show "Sort By DF/SF". Then when I press the button again the sheet should sort by DF/SF (black letters on top and red on the bottom) and the button should change to "Sort By Team"


    I've tried this but it didn't work.



    Of course I do have 2 macros that are called "SortTeam" and another called "SortDFSF" They work fine with 2 separate buttons.



    I have posted HERE as well. Don't mean to cross post but I did include the link to the other post!!

  • Re: Sort Using Toggle Button


    hi randy try below code: Change cell A1 to 1 before running this code and also delete the lines


    Code
    ActiveSheet.Protect Password:=""


    from existing code you have.


  • Re: Sort Using Toggle Button


    Quote from MrRedli;768951

    hi randy try below code: Change cell A1 to 1 before running this code and also delete the lines


    Code
    ActiveSheet.Protect Password:=""


    from existing code you have.




    No that didn't work. I did however upload my sheet with all the vb code.



  • Re: Sort Using Toggle Button


    Hi RandyD123,
    It was button eight

  • Re: Sort Using Toggle Button


    Quote from pike;768975

    Hi RandyD123,
    It was button eight


    Wow, 100% correct. Thank You very much. I tried to figure out what was "Button 1" but I couldn't find any reference. Where did I go wrong?

  • Re: Sort Using Toggle Button


    so now when I make a copy (second tab) the code errors out. I think it might be a different "Button #" but I don't know for sure.


    EDIT UPDATE: I figured it out!!! Thank You again for the help. This is solved!!!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!