help with comboboxes

Kmsanton

Board Regular
Joined
Jul 7, 2006
Messages
91
I'm looking to attach a macro to one of my comboboxes. I created a combobox using the "forms" toolbar. I've entered two options into the combobox, No and Yes. When the user picks "yes", which is the first option in the combox I want a textbox to appear and a cell to change colours. I've created the textbox using the "control toolbox" toolbar.

So basically what I need to happen is when you click the "Yes" option I want my textbox to appear and cell C5 to turn white.

Any ideas?
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi,

this question will probably be resolved, but first some questions
a yes+no combobox can be replaced by a checkbox: for you too?
what happens when you click no (or uncheck the checkbox): is textbox hidden again ? what happens to C5

kind regards,
Erik
 
Upvote 0
I actuall figured it out. I wanted the combobox to make my textbox appear when I picked the "yes" option so i entered this code.

Sub combobox1_change()
If ComboBox1.Value = "Yes" Then
TextBox_1.Visible = True

Else
TextBox_1.Visible = False
End If
End Sub
 
Upvote 0
fine you got it sorted :)

compact code would be
Code:
TextBox_1.Visible = ComboBox1.Value = "Yes"

and think about the checkbox - if possible - which is easier to use

best regards,
Erik
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,427
Members
448,961
Latest member
nzskater

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