ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OptionButton selection dilema (https://www.excelbanter.com/excel-programming/307838-optionbutton-selection-dilema.html)

Paul

OptionButton selection dilema
 
Using XL 2000

I have 10 OptionButtons, assigned to 5 questions. The user
can select either yes or no to each question.

Example...

If Q1; Yes was selected, I require a string to be placed
into Worksheets("Lines").Cells(NewRow, "Z") = "Cr3"

If Q1; No was selected, I require a string to be placed
into Worksheets("Lines").Cells(NewRow, "Z") = "Cr6"

and so on for Q2-Q5

all five Q's are mandatory so I figure bundling them into
a button control would somehow check each for a repsonse,
any ideas on this procedure would be bonus.

Any suggestion appreciated. Many thanks

Paul



Tom Ogilvy

OptionButton selection dilema
 
In a general module
Public NewRow as Long

somewhere you set the value of New Row

then in the module associated with the worksheet or userform:

Private Sub OptionButton1_Click()
if OptionButton1.Value then
Worksheets("Lines").Cells(NewRow, "Z") = "Cr3"
End if
End Sub

Private Sub OptionButton2_Click()
if OptionButton2.Value then
Worksheets("Lines").Cells(NewRow, "Z") = "Cr6"
End if
End Sub

You should use the groupname property of the option buttons to put each pair
in a separate group. Name chosen is immaterial; it should just be unique to
the pair.

--
Regards,
Tom Ogilvy




"Paul" wrote in message
...
Using XL 2000

I have 10 OptionButtons, assigned to 5 questions. The user
can select either yes or no to each question.

Example...

If Q1; Yes was selected, I require a string to be placed
into Worksheets("Lines").Cells(NewRow, "Z") = "Cr3"

If Q1; No was selected, I require a string to be placed
into Worksheets("Lines").Cells(NewRow, "Z") = "Cr6"

and so on for Q2-Q5

all five Q's are mandatory so I figure bundling them into
a button control would somehow check each for a repsonse,
any ideas on this procedure would be bonus.

Any suggestion appreciated. Many thanks

Paul






All times are GMT +1. The time now is 11:07 PM.

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