+ Reply to Thread
Results 1 to 7 of 7

Radio Button to discount value in cell

  1. #1
    Registered User
    Join Date
    07-23-2005
    Posts
    46

    Question Radio Button to discount value in cell

    Hi I have used the form toolbar to add two radio buttons to my spreadsheet.

    One is called OptionButton1_Click, the other is called OptionButton2_Click

    I have a list in cells B4:B22 and the sum is calculated in cell B24.

    I would like to use the radio buttons to allow me to do the following -

    If OptionButton1_Click is cheked cells B7 & B8 will be discounted from the figure found in B24 and the figure in B6 will be included.

    If OptionButton2_Click is checked cells B7 & B8 will be included in the figure found in B24 and the figure in B6 will be discounted.

    It seems that excel automatically disallows having both selected so i am guessing I do not need to include this in my code.

    Please can someone help me to code this. Thanks for any help you can offer.

    Rob
    Last edited by robhargreaves; 04-10-2007 at 03:40 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Rob,

    I think of several ways to do this. The values to be discounted could be changed to their opposite sign (postive to negative and vice versa). Clearing the values doesn't seem like a good approach since this a list. The last would be to have the macro do the summing and place the result in B24 provided you don't have a SUM(B4:B22) formula in the cell. How would like to do this?

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    07-23-2005
    Posts
    46
    The value does have =sum(B4:B22).

    Is this not possible then?

  4. #4
    Registered User
    Join Date
    07-23-2005
    Posts
    46
    Sorry Leith,

    I would like to change the values to negative if checked this would be the best option. Can you tell me how this is done.

    Thank you for your help.

    Rob

  5. #5
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi, Rob. If you don't mind VBA replacing the formula in cell B24 with the total based on your radio button options, then you could use something like this:
    Please Login or Register  to view this content.
    Alternatively, if you simply want to change the applicable values to negatives, you can use something like this:
    Please Login or Register  to view this content.
    HTH

    Jason
    Last edited by jasoncw; 04-10-2007 at 04:28 PM.

  6. #6
    Registered User
    Join Date
    07-23-2005
    Posts
    46
    Thanks Jason; thats absolutely brilliant the first option works a treat.

    Regards,

    Rob

  7. #7
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    No problem, Rob. Glad I could help.

+ 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