View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
external usenet poster
 
Posts: 1,565
Default Radio Button output


I am wondering if the first one will really give you everything yow wanted.
If you want a specified range to fill with the answers then maybe this
modified version would work better. Let's say we are using Column D for the
answer range.

Dim x As Long 'Outside the macro

Private Sub CommandButton1_Click() 'Change button name
If CommandButton1.Value = True Then
If x = Nothing Then x = 2
Range("D" & x) = "Yes"
CommandButton1.Value = False
x = x + 1
End If
End Sub

This way, x will update from either macro so that the answers will be in
sync with the questions. Unless, of course, they skip one. This assumes
row 1 will be a header row.

"JLGWhiz" wrote in message
...
For the Yes button:

Private Sub CommandButton1_Click() 'Change button name
If CommandButton1.Value = True Then
ActiveCell = "Yes"
CommandButton1.Value = False
End If
End Sub

Same code for the other button, except ActiveCell = "No".


"sam" wrote in message
...
Hi All,

I have designed a form in excel with radio buttons 'Yes' And 'No'

How can I fill a cell with Yes if 'Yes' Radio button is selected and No
if
'No' Radio button is selected?
Their Inputs of Yes and No are saved on an excel sheet, How can I progam
it
such that every record is saved and displayed in Next cell

For eg: If on form I have a Question like:

Are you a Male?
o Yes
o No

The results are exported on excel sheet like:

User Inputs(column header)

Yes
Yes
No
Yes
No
No

Thanks is Advance