Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: The use of options button (I'm sure theres a quick solution)

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Location
    Portsmouth.UK
    Posts
    557
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm sure there is an easy way but have spent a while trying to it work out. I have put two option buttons on a dialog sheet (dialog1) and I am trying to write an if statement but can not seem to determine which button has been pressed. Can anyone help!!

    Thank you in advance

  2. #2
    MrExcel MVP Al Chara's Avatar
    Join Date
    Feb 2002
    Location
    Newark, Delaware
    Posts
    1,701
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    To tell if an optionbutton has been pressed use the following:

    if optionbutton1.value=true then
    msgbox "Option Button 1 has been pressed"
    elseif optionbutton2.value=true then
    msgbox "Option Button 2 has been pressed"
    end if
    Best regards,
    Allan Chara
    http://www.mrspreadsheets.com

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Portsmouth.UK
    Posts
    557
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Do I have to substite "optionbutton1" with the name that I have given it?

    On 2002-03-22 08:55, Al Chara wrote:
    To tell if an optionbutton has been pressed use the following:

    if optionbutton1.value=true then
    msgbox "Option Button 1 has been pressed"
    elseif optionbutton2.value=true then
    msgbox "Option Button 2 has been pressed"
    end if

    [/quote]

  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    AlChara has your solution. Make sure this code is placed in the option button's change or click event. Other events could be used as well...

    Have Fun!

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Yes, I think you do

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •