+ Reply to Thread
Results 1 to 7 of 7

option button code

  1. #1
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Post option button code

    hi
    has anyone got a code for 2 simple option buttons have looked through forums and tried a few options
    [if optionbutton1=true then
    optionbutton2 =false
    end if

    and if optionbutton1 =true then
    textbox2="12"
    else
    textbox2 = 0]
    end if
    there seems to be alot o forums but none seems to work ,
    cheers colin
    Last edited by cfinch100; 01-22-2013 at 01:26 PM.

  2. #2
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: option button code

    Hi Colin, would it be possible to explain a little bit more about what you are looking for.

    - basically you can either group the two option buttons in a single group so only one can be selected at any time

    or

    - you attach code to each button that when that particular button is selected it sets the other button to false (basically mimicking the group concept)

    Assuming you would two option buttons on your form, you would also need the following two routines to ensure only one can be active at any point in time

    Please Login or Register  to view this content.
    If you like my contribution click the star icon!

  3. #3
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: option button code

    Hi.

    Try this:

    Please Login or Register  to view this content.
    Click *, if my suggestion helps you. Have a good day!!

  4. #4
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: option button code

    hi
    have added 2 option buttons yes and no.
    if yes is ticked then textbox1 is loaded with data from textbox2
    if no is ticked the amount in textbox2 is not sent to textbox1
    thought it would have been simple , so i thought
    cheers colin

  5. #5
    Valued Forum Contributor
    Join Date
    02-09-2012
    Location
    Mauritius
    MS-Off Ver
    Excel 2007
    Posts
    1,055

    Re: option button code

    Try this:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert OllieB's Avatar
    Join Date
    12-20-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2007 (home) & 2010 (office)
    Posts
    1,542

    Re: option button code

    Hi COlin,

    that is indeed not difficult to achieve. I assume however you only want this "copy into textbox1" to happen when the user clicks OK or something, right?

    code for the option buttons
    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    10-01-2012
    Location
    england
    MS-Off Ver
    Excel 2016 pro
    Posts
    772

    Re: option button code

    hi
    thats right just to copy from textbox to textbox on a yes click
    been going round and round and not getting anywhere
    many thanks colin

+ 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