View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
K Dales[_2_] K Dales[_2_] is offline
external usenet poster
 
Posts: 1,163
Default Combination of 2 combo boxes to populate 3rd

This can be done: you need to set up data ranges somewhere (maybe on a hidden
sheet) with each set of selections listed together, e.g.

Coach A Coach D
Coach B Coach E ...

Coach B ....
Coach C

The code below should work, substituting in the proper ranges; I am sure it
could be simplified, too, if you lay out your coaches lists smartly and use
some math to match the range to the selections in the first 2 comboboxes...

Private Sub cboAge_Change()

Select Case Range(LinkedCellforAge)
Case 8
If Range(LinkedCellforLevel) = "Level 1" Then cboCoach.ListFillRange =
Range(CoachesRange1)
If Range(LinkedCellforLevel) = "Level 2" Then cboCoach.ListFillRange =
Range(CoachesRange2)
Case 9
If Range(LinkedCellforLevel) = "Level 1" Then cboCoach.ListFillRange =
Range(CoachesRange3)
If Range(LinkedCellforLevel) = "Level 2" Then cboCoach.ListFillRange =
Range(CoachesRange4)
Case 10
If Range(LinkedCellforLevel) = "Level 1" Then cboCoach.ListFillRange =
Range(CoachesRange5)
If Range(LinkedCellforLevel) = "Level 2" Then cboCoach.ListFillRange =
Range(CoachesRange5)
End Select

End Sub

Private Sub cboLevel_Change()

Call cboAge_Change

End Sub



"AJ" wrote:

Thank you for helping. I am used to working with Access, but am trying to
work on a project where I'm required to use Excel programming. If you would
make some notes in your programming, that would be very helpful for me to
learn.

This is where I need some help, and I'll draw it out since I think it will
explain it better:

Level Age 8 Age 9 Age 10
Level 1 Coach A&B Coach B&C Coach D&E
Level 2 Coach F&G Coach H&I Coach J&K

I would like to make 3 combo boxes, the first of which would ask for a
child's level (cboLevel), the second would prompt for age (cboAge), and the
third combo box would display a choice of coach (cboCoach) based on the
answers from the prior two combo boxes.

Thanks in advance for your help.