Dependant combo boxes

  • Thread starter Thread starter harpscardiff
  • Start date Start date
H

harpscardiff

Hi,

I've got a form with frames, text boxes, multipages and drop downs.
On one of the mulitpages, (page 1), I have two combo boxes, combo1 and
combo2.

Combo1 has main catergories:
Hardware
Software

I want combo2 to have results based on which option is selected from
combo1.

Combo2 if hardware:
PC
Monitor
Keyboard
Mouse
Telephone
Printer

Combo2 if software:
Word
Excel
power point
outlook

[ F O N T = \ " A r i a l B l a c k \ " ] A n y c h a n c e t h
i s c a n b e d o n e ? [ / F O N T ]

I've tried for hardware:


Code:
--------------------
Private Sub txtsubcat_AfterUpdate()
If combo1.Value = "PC" Then
With txtsubcat
.AddItem ("PC Base Unit")
.AddItem ("Monitor")
.AddItem ("Keyboard")
.AddItem ("Mouse")
End With

End If
End Sub
 
Create named ranges named "Hardware" and "Software" and then modify sample
code below:

Private Sub ComboBox1_Change()
ComboBox2.RowSource = ComboBox1.Value
End Sub

Private Sub UserForm_Initialize()
With ComboBox1
.AddItem "Hardware"
.AddItem "Software"
End With
End Sub


HTH
 
Back
Top