PDA

View Full Version : [SOLVED] Help With Option Buttons in VBA UserForm



harber95
07-21-2015, 02:58 AM
How do I make a connection between an option button and a textbox in a userform?

Kenneth Hobs
07-21-2015, 06:05 AM
I don't know what you mean by connection. If an optionbutton is clicked, then the value is true. Set the textbox1 value as you like for the click event.

Private Sub OptionButton1_Click()
TextBox1.Value = "OptionButton1"
End Sub


Private Sub OptionButton2_Click()
TextBox1.Value = "OptionButton2"
End Sub

harber95
07-21-2015, 09:43 AM
Thanks

Kenneth Hobs
07-21-2015, 09:49 AM
I gave the most simple example possible. The code goes into the Userform object. What you do with it from there when you change code, I would have no idea why it would error. Either post the code or better yet, attach a sample workbook. To do that, click the Go Advanced button in lower right of a reply, and then click the paperclip icon on the toolbar to browse to your file.

The error should show where the problem is at. Sounds like you probably miss-typed a control name.

harber95
07-21-2015, 09:54 AM
My bad. I had to edit my replay in the last moment before I got it to work.