+ Reply to Thread
Results 1 to 4 of 4

Auto sort macro for ScrollBar event

  1. #1
    Registered User
    Join Date
    04-17-2012
    Location
    Atlanta, Ga
    MS-Off Ver
    Excel 2007
    Posts
    2

    Auto sort macro for ScrollBar event

    Hey all,

    I am currently trying to do something similar as to what I found on this forum, which is trying to automatically sort data in a bar chart when I change the ScrollBar. I have been working on this for some time now and I cannot figure out what exactly I am doing wrong. In my excel file, I have the following: I have a Main Graph sheet which contains the bar chart and the scroll bars. The only other tab that I am currently trying to get to work with this is the Clutch sheet. As of right now, the way this is suppose to work:

    On the Main Graph Sheet, when you move the Scrollbar under Blocks Rating, it should change the value in all of Column G in the Clutch Sheet. If you also change the Steals Rating, it should also change Column G in the Clutch Sheet. I plan to eventually do this for all other sheets within the excel file, and would like to know if I could have the data in the Main Graph be varied when someone chooses what data they would like to see in a drop down menu. This is the current Macro that is in place. Could anyone help? I've been stuck on this for 6 hours.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: Auto sort macro for ScrollBar event

    Try this approach.

    1. Make sure all your data sheets have the same columns and headings.
    2. Format all your tables as Excel Tables INSERT\TABLE. This step is necessary as the Table will keep the named ranges in the next step up to date when data as added to the tables.
    3. Select the data that forms the charts (ie the name column and column G, then give it a name. To do this, go to the "NAME BOX" and type a name (ie give it the same name as your sheet name).

    I have created 2 macros in this sheet and added some buttons - these macros do what you want. You may like to work out the drop down box bit yourself from here, or ask for more help if you get stuck.

    Matt
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    04-17-2012
    Location
    Atlanta, Ga
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Auto sort macro for ScrollBar event

    So, is it not possible to have the order changed automatically when I move the slider bar at all? Also, I don't quite understand what the buttons do. What I would like to see is when any change is made, the order of the players will automatically change into a descending order. When I try the buttons, it does not order them.

  4. #4
    Valued Forum Contributor
    Join Date
    06-16-2006
    Location
    Sydney, Australia
    MS-Off Ver
    2013 64bit
    Posts
    1,394

    Re: Auto sort macro for ScrollBar event

    OK, maybe I am confused with what you are trying to do. There is a "sort function" I have seen once upon a time, that somehow magically sorts the data in place. Take a look at this link. If use this approach and base your chart on the sorted column, it may work for you.

    http://www.get-digital-help.com/2009...array-formula/

    Edit: Better Still

    I have added some sort code in the scrollbar change event

    Please Login or Register  to view this content.
    I think this does what you want
    Attached Files Attached Files
    Last edited by Mallycat; 04-19-2012 at 02:00 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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