+ Reply to Thread
Results 1 to 6 of 6

Running a cell formula only when a button is clicked

  1. #1
    Registered User
    Join Date
    07-15-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    14

    Running a cell formula only when a button is clicked

    How can I have a cell run a formual only when a button is clicked?

    I have a quiz spread sheet with drop-down lists for answers and cells that have a formula that checks the answers and displays "Correct" if the answer is right. The "Correct" is black on black to hide it, it's just there for the COUNTIF later.

    I have cell F30 at the end with this formula: =COUNTIF(B5:J21, "Correct") which counts all instances of "Correct" and displays the total. I understand this needs a macro but my guess of F30=COUNTIF(B5:J21, "Correct") doesn't work.

    How can I do this, please? Thanks.

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Running a cell formula only when a button is clicked

    Why do you need a macro to do this?

  3. #3
    Registered User
    Join Date
    07-15-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Running a cell formula only when a button is clicked

    Quote Originally Posted by StephenR View Post
    Why do you need a macro to do this?
    Because right-clicking on my button gives me a context menu which includes "Assign Macro..." makes me think I need one to do it.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Running a cell formula only when a button is clicked

    What I mean is, why don't you just put the formula in the cell manually?

    In any case you would need this:
    Please Login or Register  to view this content.
    Last edited by StephenR; 11-23-2012 at 01:35 PM.

  5. #5
    Registered User
    Join Date
    07-15-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Running a cell formula only when a button is clicked

    [QUOTE=StephenR;3019762]What I mean is, why don't you just put the formula in the cell manually?

    Because I don't want the user to see the value until the button is clicked.

  6. #6
    Registered User
    Join Date
    07-15-2012
    Location
    UK
    MS-Off Ver
    Excel 2003
    Posts
    14

    Re: Running a cell formula only when a button is clicked

    Quote Originally Posted by StephenR View Post
    In any case you would need this:
    Please Login or Register  to view this content.
    That did it! Thank you! :-)

+ 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