ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Placing Optionbutton Value (https://www.excelbanter.com/excel-programming/321218-placing-optionbutton-value.html)

Patrick Simonds

Placing Optionbutton Value
 
I have 3 optionbuttons (optionbutton1 - 3) which are in optiongroup lunch.
Since only one of the three button can be active, how would I place that
value of the active optionbutton in a cell.

optionbutton1 = 0
optionbutton2 = 30
optionbutton3 = 60



Colo[_105_]

Placing Optionbutton Value
 
Patrick, please see the code below.

Private Sub OptionButton1_Click()
ActiveCell.Value = 0
End Sub

Private Sub OptionButton2_Click()
ActiveCell.Value = 30
End Sub

Private Sub OptionButton3_Click()
ActiveCell.Value = 60
End Sub


--
Regards,
Colo
http://www.puremis.net/excel/

"Patrick Simonds" wrote in message
...
I have 3 optionbuttons (optionbutton1 - 3) which are in optiongroup lunch.
Since only one of the three button can be active, how would I place that
value of the active optionbutton in a cell.

optionbutton1 = 0
optionbutton2 = 30
optionbutton3 = 60




Patrick Simonds

Placing Optionbutton Value
 
I am hoping to do this when I click on a Finished commandbutton and have all
item (including the optionbutton selection) placed on the worksheet at the
same time.


"Colo" wrote in message
...
Patrick, please see the code below.

Private Sub OptionButton1_Click()
ActiveCell.Value = 0
End Sub

Private Sub OptionButton2_Click()
ActiveCell.Value = 30
End Sub

Private Sub OptionButton3_Click()
ActiveCell.Value = 60
End Sub


--
Regards,
Colo
http://www.puremis.net/excel/

"Patrick Simonds" wrote in message
...
I have 3 optionbuttons (optionbutton1 - 3) which are in optiongroup
lunch.
Since only one of the three button can be active, how would I place that
value of the active optionbutton in a cell.

optionbutton1 = 0
optionbutton2 = 30
optionbutton3 = 60






Colo[_105_]

Placing Optionbutton Value
 
So the code for the CommansButton would be something like this.


Private Sub CommandButton1_Click()
Dim lngValue As Long
If OptionButton1.Value Then lngValue = 0
If OptionButton2.Value Then lngValue = 30
If OptionButton3.Value Then lngValue = 60
ActiveCell.Value = lngValue
End Sub



--
Regards,
Colo
http://www.puremis.net/excel/


"Patrick Simonds" wrote in message
...
I am hoping to do this when I click on a Finished commandbutton and have

all
item (including the optionbutton selection) placed on the worksheet at the
same time.


"Colo" wrote in message
...
Patrick, please see the code below.

Private Sub OptionButton1_Click()
ActiveCell.Value = 0
End Sub

Private Sub OptionButton2_Click()
ActiveCell.Value = 30
End Sub

Private Sub OptionButton3_Click()
ActiveCell.Value = 60
End Sub


--
Regards,
Colo
http://www.puremis.net/excel/

"Patrick Simonds" wrote in message
...
I have 3 optionbuttons (optionbutton1 - 3) which are in optiongroup
lunch.
Since only one of the three button can be active, how would I place

that
value of the active optionbutton in a cell.

optionbutton1 = 0
optionbutton2 = 30
optionbutton3 = 60








All times are GMT +1. The time now is 07:16 AM.

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