Combine a combobox with logic

T

THILL

Is there a way to program excel to pull a specifec list based on a cells
value ie. if a1 = 1 pull data for combox from list 1, if a1 = 2 pull data
from list 2 ect, ect
 
F

FSt1

hi
yes
you can use the gotfocus event to set the listfillrange of a sheet combo box
but your list have to be on the sheet somewhere.
example
Private Sub ComboBox1_GotFocus()
If Range("A1").Value = 1 Then
ComboBox1.ListFillRange = "G1:G5"
Else
If Range("A1").Value = 2 Then
ComboBox1.ListFillRange = "H1:H5"
Else
ComboBox1.ListFillRange = "I1:I5"
End If
End If
End Sub
with a form combo box(ON A FORM, NOT THE SHEET), i think it's the row source.
you can also use the additem method. look that up in vb help.

Regards
FSt1
 
Top