PDA

View Full Version : conditioned comboboxes



smail
08-04-2014, 07:53 AM
Hi to all,:hi:
I am a beginner in VBA so i am sorry if i asked a stupid questions :doh: .. and i would say thank you for giving some time to see my tread.
Without lengthening i will explain my care:

i have 02 comboBoxs/userform in my example ComboBox6 ComboBox7
* Combobox6: Reserved to a list of tanks (RSA, RSB,RSD,RSE & RSD)
* Combobox7: Reserved for tanks Movement (02 choice : "RHM-LINE" or "LINE-UTBS")

What I want is : fill cells using textboxes which are conditioned by the 02 combo boxes (6 & 7)
So when I chose an item in the combobox6 saying "RSA" then i have to select in comboBox7 one of the list saying "LINE-RHM"
after that I will insert values ​​in TextBox38, TextBox39, ... TextBox43 via userform to the cells.
so,
if
ComboBox6 = "RSA" and Combobox7 = "LINE-RHM"
TextBox38 = "F52"
TextBox39 = "F53"
TextBox40 = "M52"
TextBox41 = "M53"
TextBox42 = "N52"
TextBox43 = "N53"

otherwise

if
ComboBox6 = "RSA" and Combobox7 = "LINE-UTBS"
the values of the ​​TextBoxes will:
TextBox38 = "F55"
TextBox39 = "F56"
TextBox40 = "M55"
TextBox41 = "M56"
TextBox42 = "N55"
TextBox43 = "N56"

Thanking you in advance, I address my cordial greetings:friends:.
Smail-CH

Bob Phillips
08-04-2014, 11:16 AM
Private Sub ComboBox6_Change()

With Me

Select Case .ComboBox6.Value

Case "RSA"

Select Case .ComboBox7.Value

Case "LINE-RHM"

.TextBox38.Text = "F52"
.TextBox39.Text = "F53"
.TextBox40.Text = "M52"
.TextBox41.Text = "M53"
.TextBox42.Text = "N52"
.TextBox43.Text = "N53"

Case "LINE-UTBS"

.TextBox38.Text = "F55"
.TextBox39.Text = "F56"
.TextBox40.Text = "M55"
.TextBox41.Text = "M56"
.TextBox42.Text = "N55"
.TextBox43.Text = "N56"
End Select
End Select
End With
End Sub

Private Sub ComboBox7_Change()

With Me

Select Case .ComboBox6.Value

Case "RSA"

Select Case .ComboBox7.Value

Case "LINE-RHM"

.TextBox38.Text = "F52"
.TextBox39.Text = "F53"
.TextBox40.Text = "M52"
.TextBox41.Text = "M53"
.TextBox42.Text = "N52"
.TextBox43.Text = "N53"

Case "LINE-UTBS"

.TextBox38.Text = "F55"
.TextBox39.Text = "F56"
.TextBox40.Text = "M55"
.TextBox41.Text = "M56"
.TextBox42.Text = "N55"
.TextBox43.Text = "N56"
End Select
End Select
End With
End Sub

smail
08-04-2014, 11:58 PM
I test it, but it's not working cells referred of the Textboxes won't be filled !!!!