excelenergy
Board Regular
- Joined
- Jun 7, 2012
- Messages
- 142
Hello...
In a way this is sort of the second half to a topic I posted here:
https://www.mrexcel.com/forum/excel-questions/1052587-problem-userform-initialize.html
This is an entirely different question though. In my first drop down I have three categories:
"Phones"
"Monitors"
"Computers"
Once a user selects "phones" > the second drop down is populated with
"Cisco"
"Bell"
"Oracle"
The issue is lets say, I change the selection in the first drop down from Phones to > Monitors. It will list the brands of monitors BUT it also is listing the brands of phones too.
What I'm curious about is, is there a way to exclude the brands of "phones" when a user selects monitors instead of phones. Right now - if you change the drop down to Monitors, it will list monitors, but it will still list the phones too.
In a way this is sort of the second half to a topic I posted here:
https://www.mrexcel.com/forum/excel-questions/1052587-problem-userform-initialize.html
This is an entirely different question though. In my first drop down I have three categories:
"Phones"
"Monitors"
"Computers"
Once a user selects "phones" > the second drop down is populated with
"Cisco"
"Bell"
"Oracle"
The issue is lets say, I change the selection in the first drop down from Phones to > Monitors. It will list the brands of monitors BUT it also is listing the brands of phones too.
What I'm curious about is, is there a way to exclude the brands of "phones" when a user selects monitors instead of phones. Right now - if you change the drop down to Monitors, it will list monitors, but it will still list the phones too.
Code:
Private Sub ComboBox1_Change()
Dim index As Integer
index = ComboBox1.ListIndexComboBox2.Clear
Select Case index
Case Is = 0
With ComboBox2
.AddItem "CISCO
.AddItem "Bell"
.AddItem "Oracle"
End With
Case Is = 1
With ComboBox2
.AddItem "Sony"
.AddItem "Hewlet Packard"
.AddItem "Dell"
End With
Case Is = 2
With ComboBox2
.AddItem "Acer"
.AddItem "Dell"
.AddItem "Samsung"
End With
End Select
End Sub
Private Sub ComboBox2_Change()
Select Case index
Case Is = 0
With Combobox3
.Additem "Cisco-Phone1"
.AddITEM "Cisco-Phone2"
End With
Case is = 1
With Combobox3
.Additem "Bell-Phone1"
.Additem "Bell-Phone2"
End With
Case is = 2
With Combobox3
.Additem "Oracle-Phone1"
.Additem "Oracle-Phone2"
End With
End Select
End Sub