+ Reply to Thread
Results 1 to 12 of 12

Fire Worksheet_Calculate from Radio Button-linked cell

  1. #1
    Registered User
    Join Date
    08-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    11

    Fire Worksheet_Calculate from Radio Button-linked cell

    Hi

    I'm having trouble getting the Worksheet_Calculate() macro to play nice with a set of radio buttons' linked cell. I know I could simply assign the code directly to the buttons, but I have a completely different macro already assigned to them.

    I'd attach some code but I've been through so many iterations that don't work, I don't know what to post anymore. I've attached an example sheet with mouse-over comments that explain what I'm trying to do.

    Thanks for your help, everyone.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    Works like a charm here.

    Do you put the code in a Sheet module?

    In the Immediate window in the VBA development environment, type:
    Please Login or Register  to view this content.
    to see if Events have been turned off.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    A basic worksheet_calculate() works fine for me too, but I'm trying to get the macro to focus on the change in a specific cell (the one linked to the radio buttons) and fire off a simple copy-paste macro once the value of that specific cell changes by selecting a different radio button.

  4. #4
    Registered User
    Join Date
    08-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    I believe I'm going for something like this:

    Please Login or Register  to view this content.
    But this doesn't work.
    Last edited by Cutter; 09-21-2012 at 11:01 AM. Reason: Added code tags

  5. #5
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    I use a
    Please Login or Register  to view this content.
    or a
    Please Login or Register  to view this content.
    and move it around in the code to help me see if some parts are executed. The event is firing alright but the IF does not become true. If you take a closer look at:
    Please Login or Register  to view this content.
    you will understand why...

    I understand what you are thinking however, been there done that.

    Please Login or Register  to view this content.

    This seems to be working but recalc is not instant, you can see things change. Before I switched oldval to single it took even longer time.
    Seems pretty interesting these formulas, may I ask what they do?

  6. #6
    Registered User
    Join Date
    08-23-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    11

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    Thanks for your help, Jacc. Your solution does work, but I see what you mean about the lag. It isn't a huge deal, but I'll look for ways to tweak it... it looks like the random number generator is going through multiple iterations before it settles down.

    FYI, I'm building a conceptual demo of a medical opinion scoring interface, and I'm assuming that the individual scorer's professional peers will score things fairly similarly, so I'm just generating some fake data representing non-existent people to simulate the experience of casting a vote within a committee.

  7. #7
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    Good stuff!

    I couldn't quite let go of this one, he he...

    I turned off EnableEvents and that stopped the "iterations" it was doing with the previous code.
    But what triggered those iterations? And why did they stop after awhile? Anyone care to shed some light on this mystery?

    Please Login or Register  to view this content.

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    you ought to declare oldval outside the procedure really
    Please Login or Register  to view this content.
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  9. #9
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    @ Dr_Gzus

    Welcome to the forum.

    Please notice that code tags have been added to your post (#4). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at the top of the page and read Rule #3.
    Thanks.

  10. #10
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    Thanks for pointing that out JosephP, I guess that would make it run a bit more efficient. Any idea of why it triggers calculation a number of times before settling down?

  11. #11
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    the formulas are volatile so changing values in column e causes them to recalculate which triggers the calculate event again and so on. really it ought to crash completely ;-)

  12. #12
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,844

    Re: Fire Worksheet_Calculate from Radio Button-linked cell

    Ok thanks. Adding this link for good measure.
    http://www.decisionmodels.com/calcsecretsi.htm

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1