utilisation de deux ComboBox avec if then
Bonsoir à tous
j'utilise un userforme presentant une zone de saisie et deux ComboBox:
ComboBox1 pour selectionner le produit
ComboBox2 pour selectionner l'année
Et aprés les deux selections je saisie les données .Je passe par un appel de procedure pour le chargement sur une feuille excel
Code:
1 2 3 4 5 6 7 8 9 10
| Private Sub Charger_Click()
If ComboBox2.Value = "2009" Then
Call extractive1
Unload Me
End If
If ComboBox2.Value = "2009" Then
Call travail1
Unload Me
End If
End Sub |
pour le second chargement ça ne passe pas je voulais une aide
la procedure extractive1 saisie les element d'un produit suivant l'année
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub extractive1()
If ComboBox1.Value = "INDUSTRIES EXTRACTIVES" Then
If Me.TextBox1.Text <> "" Then
Sheets("CA industrie").Range("AN47").Value = Me.TextBox1
End If
If Me.TextBox2.Text <> "" Then
Sheets("CA industrie").Range("AO47").Value = Me.TextBox2
End If
If Me.TextBox3.Text <> "" Then
Sheets("CA industrie").Range("AP47").Value = Me.TextBox3
End If
If Me.TextBox4.Text <> "" Then
Sheets("CA industrie").Range("AQ47").Value = Me.TextBox4
End If
If Me.TextBox5.Text <> "" Then
Sheets("CA industrie").Range("AR47").Value = Me.TextBox5
End If
end sub |
et la procedure travail1
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Private Sub travail1()
If ComboBox1.Value = "TRAVAIL DES GRAINS" Then
If Me.TextBox1.Text <> "" Then
Sheets("CA industrie").Range("AN52").Value = Me.TextBox1
End If
If Me.TextBox2.Text <> "" Then
Sheets("CA industrie").Range("AO52").Value = Me.TextBox2
End If
If Me.TextBox3.Text <> "" Then
Sheets("CA industrie").Range("AP52").Value = Me.TextBox3
End If
If Me.TextBox4.Text <> "" Then
Sheets("CA industrie").Range("AQ52").Value = Me.TextBox4
End If
If Me.TextBox5.Text <> "" Then
Sheets("CA industrie").Range("AR52").Value = Me.TextBox5
End If
End sub |