+ Reply to Thread
Results 1 to 4 of 4

Selecting stars with mouse click and totaling

  1. #1
    Registered User
    Join Date
    05-12-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Selecting stars with mouse click and totaling

    Hello Excel experts,

    I am trying to complete a task, can someone help?

    Here are my requirements:

    1. Allow user to select the star rating with a mouse click. They can select up to 5 stars.
    2. Display the total number of selected stars under the "Total Stars" column.

    I saw this thread and and thought this was a good starting point.

    I am a complete macro newbie and have no idea how to modify this code to meet the above requirements *and* insert the macro.

    I have attached my file so you can see. If someone could modify the file directly and re post I would be so grateful.

    Thank you!

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

  2. #2
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Selecting stars with mouse click and totaling

    Hi

    The following code which works when you double click a cell should do the trick.
    Double clicking changes the star from black to yellow and vice versa, and either adds or subtracts for the total in column G

    Please Login or Register  to view this content.
    Attached Files Attached Files
    --
    Regards
    Roger Govier
    Microsoft Excel MVP

  3. #3
    Registered User
    Join Date
    05-12-2011
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Selecting stars with mouse click and totaling

    Hello Roger,

    First of all, thank you so much for your reply. This is my first experience with the forum and I'm absolutely thrilled there's experts like yourself out there in cyber space. Regarding the solution, this is almost exactly what I was looking for. A slight tweak would make this perfect. As it is now, the user has to double click each star to turn it yellow. It would be ideal if you could add the following two things:

    1) Single click to turn the star yellow
    2) When the user clicks one star it turns the previous stars yellow. For example, if the user single-clicked the 4th star then star 1, 2, 3, and 4 would turn yellow. Similarly, if the user single-clicked the 2nd star it would turn star 1 and 2 yellow.

    The attached doc demonstrates this well. I just don't know how to integrate this functionality with your VB code.

    Thanks a million, really!!!!
    Attached Files Attached Files

  4. #4
    Valued Forum Contributor
    Join Date
    07-17-2005
    Location
    Abergavenny, Wales, UK
    MS-Off Ver
    XL2003, XL2007, XL2010, XL2013, XL2016
    Posts
    608

    Re: Selecting stars with mouse click and totaling

    Hi

    Amending the code to change all cells to the left of the cell chosen is easy enough to achieve.
    I am assuming that if you had 4 cells coloured Yellow in a row, and you then clicked on a cell in column C, you would want all cells turned black, not just column B and C, leaving D and E as Yellow

    The included code, will now set everything in the row back to black if the selected cell is already Yellow, and will colour all cells up to and including the selected cell as Yellow, if the colour is already Black.

    Whatever we do, is going to involve more than 1 click anyway.
    There are various events that can be used to trigger off a reaction on a sheet.

    Before Double Click - which I chose

    Before Right Click - which would mean having to disable the normal right click menu you get when right clicking a cell, and I do not favour

    Selection Change - which happens as soon as you select a different cell on the sheet.

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

    If we use Selection change, then having moved to a cell, the above events would take place, but you would then need to move to another cell in order to get the change back again.

    I personally still favour the double click method, but I have left both enabled in the attached file.
    You can either Rem out the block of code you don't want, or delete it.

    I hope that this helps
    Attached Files Attached Files

+ 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