ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign Value to OptionBotton then transfer to spreadsheet (https://www.excelbanter.com/excel-programming/298218-assign-value-optionbotton-then-transfer-spreadsheet.html)

Excel Nerd

Assign Value to OptionBotton then transfer to spreadsheet
 
Hello all,

I need a general education on how to program an OptionButton.

I have created a userform in visual basic. It has a frame with
option buttons. One of which, specifies "Other", and has a textbox fo
user input.


What code is needed to:
1. Assign a value to each option button
2. Have the value assigned put into
ThisWorkbook.Sheets("Masterlist").Range("d2") - if the option i
selected

Please help...
Excel Nerd:confused

--
Message posted from http://www.ExcelForum.com


Bob Phillips[_6_]

Assign Value to OptionBotton then transfer to spreadsheet
 
Optionbuttons cannot be assigned values per se, they can only be on or off.
You could check it when pressed and set the value that way

Private Sub OptionButton1_Click()
If Me.OptionButton1.Value Then
Range("B1").Value = "Button off"
End If
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Excel Nerd " wrote in message
...
Hello all,

I need a general education on how to program an OptionButton.

I have created a userform in visual basic. It has a frame with 5
option buttons. One of which, specifies "Other", and has a textbox for
user input.


What code is needed to:
1. Assign a value to each option button
2. Have the value assigned put into -
ThisWorkbook.Sheets("Masterlist").Range("d2") - if the option is
selected

Please help...
Excel Nerd:confused:


---
Message posted from http://www.ExcelForum.com/





All times are GMT +1. The time now is 09:53 PM.

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