using option buttons

4

4ndy

Hi,
thanx in advance for anybody who helps me

For my school work i have been asked to create an insurance quotatio
system, at the moment i decided to do everything in userforms, so fa
all has gone smootly until i started to do the optionboxes for gender
how do i get the two to link, instead of each being seperate, i have n
problem with both options linking to a cell within excel, but fo
userforms it seems to be a completely different matter, no matter wha
i try i cant seem to get the two boxes to work together they both tur
grey...

Sorry if this post is badly written im just pretty frustrated with thi
now ;
 
D

Dave Peterson

First, I would think that you would put the two gender optionbuttons in a frame
(to group them).

And then if you're using the controlsource, remove that and do it in code:

Option Explicit

Private Sub CommandButton1_Click()
Dim myCell As Range

Set myCell = Worksheets("sheet1").Range("a1")

If Me.OptionButton1.Value Then
myCell.Value = "Male"
Else
myCell.Value = "Female"
End If

End Sub

Since this is an either/or question, you could use a checkbox and just check it
if male (as an alternative).
 
Top