![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Mar 2002
Location: Portsmouth.UK
Posts: 543
|
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 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Monterrey, Mexico
Posts: 1,433
|
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
__________________
Kind regards, Al Chara |
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Mar 2002
Location: Portsmouth.UK
Posts: 543
|
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 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
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 |
|
Board Regular
Join Date: Mar 2002
Location: Cincinnati, Ohio, USA
Posts: 6,824
|
Yes, I think you do
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|