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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
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
 

Kmsanton

Board Regular
Joined
Jul 7, 2006
Messages
91
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
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
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
 

Forum statistics

Threads
1,141,849
Messages
5,708,973
Members
421,602
Latest member
jkpce1880

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
Top