ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Userform change question (https://www.excelbanter.com/excel-programming/387046-userform-change-question.html)

Patrick C. Simonds

Userform change question
 
I have a UserForm on which I have placed an OptionButton Group (Mr, Mrs, Ms,
Dr) and OptionButton Group (Male, Female). What I would like to have happen
is that when I select Mr, Male OptionButton becomes true, Mrs or Ms, Female
becomes true. If Dr is selected I want nothing to happen and then the user
will select the correct gender.



Norman Jones

Userform change question
 
Hi Patrick

Try something like:

'=============
Private Sub optMR_Click()
optMale.Value = True
End Sub

'---------------
Private Sub optMRS_Click()
OptFemale.Value = True
End Sub

'---------------
Private Sub optMS_Click()
OptFemale.Value = True
End Sub

'---------------
Private Sub optDR_Click()
optMale = False
OptFemale = False
End Sub
'<<=============


---
Regards,
Norman


"Patrick C. Simonds" wrote in message
...
I have a UserForm on which I have placed an OptionButton Group (Mr, Mrs,
Ms, Dr) and OptionButton Group (Male, Female). What I would like to have
happen is that when I select Mr, Male OptionButton becomes true, Mrs or Ms,
Female becomes true. If Dr is selected I want nothing to happen and then
the user will select the correct gender.




Jay

Userform change question
 
Similarly, you could try this:

Private Sub obMr_Change()
If obMr = True Then obMale = True Else obMale = False
End Sub

Private Sub obMrs_Change()
If obMrs = True Then obFemale = True Else obFemale = False
End Sub

Private Sub obMs_Change()
If obMs = True Then obFemale = True Else obFemale = False
End Sub

--
Jay


"Patrick C. Simonds" wrote:

I have a UserForm on which I have placed an OptionButton Group (Mr, Mrs, Ms,
Dr) and OptionButton Group (Male, Female). What I would like to have happen
is that when I select Mr, Male OptionButton becomes true, Mrs or Ms, Female
becomes true. If Dr is selected I want nothing to happen and then the user
will select the correct gender.





All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com