View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
ALEX ALEX is offline
external usenet poster
 
Posts: 493
Default Populate one combo box based on the selection of another combo

I get an Obeject Required error message when I your code. I am working with
controls on a worksheet


Sub DropDown2_Change()

Select Case ComboBox.xls!DropDown2.Value 'Select case using the combobox1 _
current value
Case "ford" 'if it's ford do the code below
ComboBox.xls!DropDown2.List = Array("mustang", "fusion") 'load an array of
models _ to the second combobox
Case "other" 'if it's other do the code below
ComboBox.xls!DropDown2.List = Array("some car", "some other car") 'as above
load _ the array
End Select
ComboBox.xls!DropDown2.ListIndex = 0 'set the second combobox to the first
value _ which would be 0 this will remove the previous array from showing in
the List
End Sub

"Incidental" wrote:

Hi Alex

One way you can do it is to use select case to load an array into the
model combobox like the code below

Private Sub ComboBoxCar_Change()
Select Case ComboBoxCar.Value 'Select case using the combobox1 _
current value
Case "ford" 'if it's ford do the code below
ComboBoxModel.List = Array("mustang", "fusion") 'load an array of
models _
to the second combobox
Case "other" 'if it's other do the code below
ComboBoxModel.List = Array("some car", "some other car") 'as above
load _ the array
End Select
ComboBoxModel.ListIndex = 0 'set the second combobox to the first
value _
which would be 0 this will remove the previous array from showing in
the list
End Sub

hope this is of some help

S