Excel Userform - Select an option, fill a text box?

hobbes922

New Member
Joined
Jan 17, 2012
Messages
11
Hello,

For a userform, I am looking for a code that will enter a certain text into a textbox when 4 option boxes are clicked.

For example,

OptionBox1, OptionBox2, OptionBox3, and OptionBox4 are selected.
Textbox1 populates with "text".

Does anyone have any idea how to do this?

Thanks!
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Hello,

For a userform, I am looking for a code that will enter a certain text into a textbox when 4 option boxes are clicked.

For example,

OptionBox1, OptionBox2, OptionBox3, and OptionBox4 are selected.
Textbox1 populates with "text".

Does anyone have any idea how to do this?

Thanks!


Hi Welcome to the board.

Something like this?


If Optionbox1.Value = True and Optionbox2.Value = True and Optionbox3.Value = True and Optionbox4.Value = True Then
Textbox1.Text = "text"
End If
 
Upvote 0
Hi bjurney,

Thanks for the reply. I have renamed all of my option buttons and wrote in teh corresponding names. Didn't seem to work.

I should mention that I placed this code after clicking on the textbox I added to the userform. Maybe it doesn't belong there?
 
Upvote 0
Well it depends on when you want the "text" to be in the textbox. If you want it to appear in the textbox after you click on it, then you can keep the code as is. Or if you want it to take effect when you press a button, you can put it in with a Button Click event.

Are your optionbuttons independent from each other, or can only one be clicked "True" at a given time?
 
Upvote 0
I'd like for the textbox to automatically populate when the options are selected.

All four option boxes are independent, and in their own group.

The code works well if I use it under my "Next" option button, though.
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top