Linking Userform Textbox with Userform Combobox Drop Down Value

PatHat

New Member
Joined
Oct 16, 2018
Messages
18
Hi Guys,

I would love some help here if you can.

I have a Userform that has a Textbox1 and a Combobox1, with a command button. The Combo Box drop down has a list of items and gets the data from a sheet somewhere else in the workbook.
What I'd like to happen is if the user selects the PERSONAL EFFECTS option from the combo box drop down list and clicks the command button, then Textbox1 on the same Userform gets filled in with text that says "Personal Effects (cover 20% of Contents Sum Insured)"

Here is my code. But when I click on the command button nothing happens on TextBox1. I'm new to VBA so forgive me if this is a silly post.

Private Sub CommandButton1_Click()
If Me.ComboBox1.Value = "PERSONAL EFFECTS" Then
Me.TextBox1.Value = "Personal Effects (cover 20% of Contents Sum Insured)"
End If
End Sub
 
Well done Pat, at least you know that you have a rather large Forum of friends who will help you out when needed.

Happy to help, and thanks for letting me know you have a working solution. I will delete the workbook I downloaded. :);)
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,214,965
Messages
6,122,500
Members
449,090
Latest member
RandomExceller01

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