Working with 2 drop down list

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

I have 2 drop down list on my spreadsheet. #1 is the master and #2 is based
on selection from #1.
For example: if a user select "Auto" in list #1, then in list #2, only a
list of Auto will be filled in.

My question is when I select a value in List#1 it automatically run both
subs combobox1_change and combobox2_change. It doesn't allow the user the
select the drop down list #2.
Can someone help me so that only sub combobox2_change runs only when drop
down list #2 is selected.

Thanks
 
Does it help to temporarily turn off events in your cb1 action code:

sub cb1_change()
Application.EnableEvents=false
.....your action code...
Application.EnableEvents=true
end sub
 
I've seen this example but using validation functionality constrains to the
current worksheet or external file that must be open. I couldn't get it to
use a range outside of the current worksheet. I store all my picklist values
on a different worksheet that's why I use the combo box list instead because
it allows to select a range outside of the current worksheet.

Taking this approach, Is there a way to run a sub once validation list#2 is
selected? With this approach, I'dhave to create a button to call the
subroutine...correct?

Kim
 
Kim,

Something to try (untested)...
Set a Public Variable
---------------------
Public StopMe as Boolean

Private Sub ComboBox1_Change()
StopMe = True
' code to update ComboBox2
StopMe = False
End Sub

Private Sub ComboBox2_Change()
If StopMe = True Then Exit Sub
' combobox2 code
End Sub
 
I do exactly what you want with 3 combo boxes.
combo1 is the main and determines what goes in combo2
combo2 thencontrols what goes in combo3

Where you are going wrong is that you need to use the
Click event not the change event
-----Original Message-----
Kim

If you name the picklist range you can use it across worksheets.

Also see Debra's page on running code on Change_Events.

http://www.contextures.on.ca/xlDataVal08.html#Change

Gord Dibben XL2002
 
Back
Top