Value in Combo Box 1 affects visibility of Combo Box 2

apz84

New Member
Joined
Jul 7, 2011
Messages
2
Hi, I was looking for some help on a excel worksheet which I have used the form control combo box on the worksheet and the combo boxes are populated by lists in hidden columns.

I have two combo boxes on the worksheet. From Combo Box 1 the user can select A, B or C. In combo box 2 the user can select between 5% through 95% (in 5% increments).

I would like combo box 2 to be hidden and only be visible upon selecting "C" in combo box 1. Is this possible? Any help would be appreciated.

Thank you!
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Something like this. FillCombo is test procedure to fill first combo.
Code:
[COLOR="Blue"]Private[/COLOR] [COLOR="Blue"]Sub[/COLOR] ComboBox1_Change()
    ComboBox2.Visible = ComboBox1.Value = "C"
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]

[COLOR="Blue"]Sub[/COLOR] FillCombo()
    [COLOR="Blue"]With[/COLOR] ComboBox1
        .Clear
        .AddItem "A"
        .AddItem "B"
        .AddItem "C"
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]With[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
Thank you but it doesn't quite seem to work. I'm using the form control version of the combo box rather than the activex if that makes any difference.

Something like this. FillCombo is test procedure to fill first combo.
Code:
[COLOR="Blue"]Private[/COLOR] [COLOR="Blue"]Sub[/COLOR] ComboBox1_Change()
    ComboBox2.Visible = ComboBox1.Value = "C"
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]

[COLOR="Blue"]Sub[/COLOR] FillCombo()
    [COLOR="Blue"]With[/COLOR] ComboBox1
        .Clear
        .AddItem "A"
        .AddItem "B"
        .AddItem "C"
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]With[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
It matters much! Forms "comboboxes" are called DropDowns. Place this code to standard module and assign this macro to first DropDown.
Code:
[COLOR="Blue"]Sub[/COLOR] OnValueChange()
    [COLOR="Blue"]With[/COLOR] ActiveSheet
        .DropDowns("ComboBox2").Visible = _
            .DropDowns("ComboBox1").List(.DropDowns("ComboBox1").ListIndex) = "C"
    [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]With[/COLOR]
[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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