inactiveUser214710
Board Regular
- Joined
- Apr 27, 2012
- Messages
- 171
Here I am again to ask for help
In a domestic project, I face a problem that I don't know how to solve it. Here's the question as an example:
I have a userform1 among other boxes, I have two combo boxes (cbo1; cbo2), by depending each other and that, will operate the opening of another userform2. In this userform2 I have just a combo box (cbo3) used for two different situations, that depending on of the instructions given by cbo1 and cbo2.
With this code below I am not getting that the cbo3 does not answer. Where the error will be.
Userform1:
Cbo1: BancA; BankB; BanKC
Cbo2: Débit; Credit, Others
Userform2
= If BankA (cbo1) and Débit(cbo2) => cbo3 open with (“A”; ”B”; ”C”);
= If BankA (cbo1) and Credit (cbo2) => cbo3 open with (“X”; ”W”; ”Y” )
= the same for BankB and BankC
Thank you
In a domestic project, I face a problem that I don't know how to solve it. Here's the question as an example:
I have a userform1 among other boxes, I have two combo boxes (cbo1; cbo2), by depending each other and that, will operate the opening of another userform2. In this userform2 I have just a combo box (cbo3) used for two different situations, that depending on of the instructions given by cbo1 and cbo2.
With this code below I am not getting that the cbo3 does not answer. Where the error will be.
Userform1:
Cbo1: BancA; BankB; BanKC
Cbo2: Débit; Credit, Others
Userform2
= If BankA (cbo1) and Débit(cbo2) => cbo3 open with (“A”; ”B”; ”C”);
= If BankA (cbo1) and Credit (cbo2) => cbo3 open with (“X”; ”W”; ”Y” )
= the same for BankB and BankC
VBA Code:
[B]' ================Code userform1======[/B]
Private Sub cbo1_Change()
With cbo2
.Clear
Select Case cbo1.Value
Case "BankA"
cbo2.List = Array("Debit", "Credit")
Case "BankB"
cbo2.List = Array("Debit", "Credit")
Case "BankC"
cbo2.List = Array("Debit", "Credit")
End Select
End With
End Sub
Private Sub cbo2_Change()
'Why this instrutions don't appear?
With UserForm2.cbo3
.Clear
Select Case cbo2.Value
Case "Debit"
UserForm2.Show
UserForm2.cbo3.List = Array("A", "B", "C")
Case "Credit"
UserForm2.Show
UserForm2.cbo3.List = Array("X", "W", "Y")
End Select
End With
End Sub
Private Sub UserForm_Initialize()
cbo1.List = Array("BankA", "BankB", "BankC")
End Sub