Using XL 2002
I'm populating the first combobox w/o any problems using an array.
Here is my prob:
When the first combobox is changed, I want to call a function. That function will determine which product description was selected. Based on that product description, I want to populate the second combo box.
I have a total of 30 comboboxes.
You can look at it as:
1a-1b
2a-2b
I want the change() of 1a to trigger population of 1b. The same goes for 2a....15a.
I am receiving Run-time error '381': Could not set the list propery. Invalid property array index.
How can I set the cboComp1 combobox by the returned value from the sub routine. This returned value would actually be an array?
Thanks
I'm populating the first combobox w/o any problems using an array.
Here is my prob:
When the first combobox is changed, I want to call a function. That function will determine which product description was selected. Based on that product description, I want to populate the second combo box.
I have a total of 30 comboboxes.
You can look at it as:
1a-1b
2a-2b
I want the change() of 1a to trigger population of 1b. The same goes for 2a....15a.
I am receiving Run-time error '381': Could not set the list propery. Invalid property array index.
How can I set the cboComp1 combobox by the returned value from the sub routine. This returned value would actually be an array?
Thanks
Code:
Private Sub Worksheet_Activate()
'Define product families array
pfam1 = Array("", "Comp1", _
"Comp2", _
"Comp3", _
"Comp4")
pfam2 = Array("", "Comp5", _
"Comp6", _
"Comp7", _
"Comp8")
pfam3 = Array("", "Comp9", _
"Comp10", _
"Comp11", _
"Comp12")
pfam4 = Array("", "Comp13", _
"Comp14", _
"Comp15", _
"Comp16")
'Populate first combobox
prodFam = Array("", "AI", "AI-3", "EZ-1", "C-I-28" )
Sheet1.cboProdFam1.List = prodFam
End Sub
Public Sub cboProdFam1_Change()
selectProdFam = cboProdFam1.Value
determinePFSelection selectProdFam
'Error 381 - Invalid property array index
cboComp1.List = selectProdFam
End Sub
Public Sub cboProdFam2_Change()
selectProdFam = cboProdFam2.Value
determinePFSelection selectProdFam
cboComp2.List = selectProdFam
End Sub
.
.
.'I have 15 different cboProdFamX combos
.
Public Sub determinePFSelection(x)
Select Case x
Case "AI"
y = pfam1
Case "AI-3"
y = pfam2
Case "EZ-1"
y = pfam3
Case "C-I-28"
y = pfam4
Case Else
y = pfam1
End Select
End Sub