hi -
using option buttons (optMale & optFemale) is good because only one
can be selected at any time, unlike checkboxes in which both could be
checked at the same time.
if this section of code is in your userform code, i believe your
problem is in the use of the keyword Me. you're already "in" Me, so
you don't have to use it. try taking that out and using your optMale
and optFemale as you did originally.
If optMale.Value = True Then
Range ws.Cells(iRow, x).Value = "Male"
ElseIf optFemale.Value = True Then
Range ws.Cells(iRow, x).Value = "Female"
End If
i may be wrong, but it's a try. :)
if this portion of code is in a regular module, then you'd need to use
"Userform1" in front of optMale and optFemale.
susan
On Jul 8, 7:58*am, levtweeney
wrote:
Simon Lloyd;407979 Wrote: Welcome to The Code Cage!, i am assuming you have checkbooxes for male
or female?
Code:
--------------------
* * If Me.CheckBox1.Value = True Then
* Range("A1").Value = "Male"
* ElseIf Me.CheckBox2.Value = True Then
* Range("A1").Value = "Female"
* End If
--------------------
naturally you would change Range("A1") for ws.Cells(iRow, x).Value
where x would be your next location
Hi Simon
Thank you so much for the reply, I really do appreciate it.
I have a couple of questions. *Why did you put Checkbox1 and Checkbox2
in the code? *Should I use “optMale” and “optFemale” as these are the
names of my option box's? *Have I added the range correctly?
If Me.optMale.Value = True Then
Range ws.Cells(iRow, x).Value = "Male"
ElseIf Me.optFemale.Value = True Then
Range ws.Cells(iRow, x).Value = "Female"
End If
When I run the above code I get an "Invalid use of property" message
I am sorry for being so silly but I really am an amateur at all of
this.
--
levtweeney
------------------------------------------------------------------------
levtweeney's Profile:http://www.thecodecage.com/forumz/member.php?userid=478
View this thread:http://www.thecodecage.com/forumz/sh...d.php?t=113703