1 pièce(s) jointe(s)
Problème de lancement de macro avec un userform
Bonjour tout le monde,
J'ai créé un userform avec des cases à cocher et un bouton à cocher (voir image ci-jointe). Quand j'appuies sur le bouton OK de mon userform je lance la macro "CommandButton1_Click" qui appelle une autre macro "Remplissage_tableau"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
|
Sub CommandButton1_Click()
'janvier
If CheckBox1.Value = False Then
mois_janvier = 0
End If
If CheckBox1.Value = True Then
mois_janvier = 1
End If
'fevrier
If CheckBox2.Value = False Then
mois_fevrier = 0
End If
If CheckBox2.Value = True Then
mois_fevrier = 1
End If
'mars
If CheckBox3.Value = False Then
mois_mars = 0
End If
If CheckBox3.Value = True Then
mois_mars = 1
End If
'avril
If CheckBox4.Value = False Then
mois_avril = 0
End If
If CheckBox4.Value = True Then
mois_avril = 1
End If
'mai
If CheckBox5.Value = False Then
mois_mai = 0
End If
If CheckBox5.Value = True Then
mois_mai = 1
End If
'juin
If CheckBox6.Value = False Then
mois_juin = 0
End If
If CheckBox6.Value = True Then
mois_juin = 1
End If
'juillet
If CheckBox7.Value = False Then
mois_juillet = 0
End If
If CheckBox7.Value = True Then
mois_juillet = 1
End If
'aout
If CheckBox8.Value = False Then
mois_aout = 0
End If
If CheckBox8.Value = True Then
mois_aout = 1
End If
'septembre
If CheckBox9.Value = False Then
mois_septembre = 0
End If
If CheckBox9.Value = True Then
mois_septembre = 1
End If
'octobre
If CheckBox10.Value = False Then
mois_octobre = 0
End If
If CheckBox10.Value = True Then
mois_octobre = 1
End If
'novembre
If CheckBox11.Value = False Then
mois_novembre = 0
End If
If CheckBox11.Value = True Then
mois_novembre = 1
End If
'decembre
If CheckBox12.Value = False Then
mois_decembre = 0
End If
If CheckBox12.Value = True Then
mois_decembre = 1
End If
Call Remplissage_tableau
End Sub |
Ca c'est l'introduction de mon problème!^^
La macro "Remplissage_tableau" (un échantillon de la macro est marqué ci-dessous) marche parfaitement si elle n'a pas les conditions If:
"If mois_janvier = 1 Then" et "End If".
Elle appelle bien la macro "Mois" et entre bien la valeur dans "B3"
Mais lorsque je mets "If mois_janvier = 1 Then" et "End If" alors lorsque je lance la macro de départ CommandButton1_Click pour lancer la macro "Remplissage_tableau" ça ne marche plus.
Code:
1 2 3 4 5 6 7 8 9 10
|
Sub Remplissage_tableau()
If mois_janvier = 1 Then
'Janvier 1 4
Call Mois("NANT DE DRANCE", 1, 4)
Workbooks("bilan_heures_calculs.xlsm").Worksheets("Sheet1").Range("B3").Value = bilanT
End If
End Sub |
J'ai l'impression que mois_janvier dans la condition "If mois_janvier = 1 Then" ne doit pas etre égal à 1 puisque rien ne marche. Alors si quelqu'un a une idée!qu'il me la dise sur le champs! :p lol
Merci bien d'avance! :D