A
Alex
Guest
Bonjour,
J'ai un petit problème avec un userform et je n'arrive pas à comprendre d'où ça vient. Voilà mes procédures:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Range("c37").Value = CheckBox1.Caption
Range("e6,e7,e8,e31").Interior.ColorIndex = 6
masquage1 = False
Else
Range("c37").Value = ""
Range("e6,e7,e8,e31").Interior.ColorIndex = xlNone
masquage1 = True
End If
End Sub
Private Sub CheckBox10_Click()
If CheckBox10.Value = True Then
Range("c93").Value = CheckBox10.Caption
masquage10 = False
Range("e17,e18,e20,e21,e31").Interior.ColorIndex = 6
Worksheets(1).Cells(18, 5) = ""
Else
Range("c93").Value = ""
masquage10 = True
Range("e17,e18,e20,e21,e31").Interior.ColorIndex = xlNone
Worksheets(1).Cells(18, 5) = 1
End If
End Sub
Private Sub CheckBox11_Click()
If CheckBox11.Value = True Then
Range("c100").Value = CheckBox11.Caption
masquage11 = False
Range("e27").Interior.ColorIndex = 6
Else
Range("c100").Value = ""
masquage11 = True
Range("e27").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox12_Click()
If CheckBox12.Value = True Then
Range("c104").Value = CheckBox12.Caption
masquage12 = False
Range("e6,e28").Interior.ColorIndex = 6
Else
Range("c104").Value = ""
masquage12 = True
Range("e6,e28").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox13_Click()
If CheckBox13.Value = True Then
Range("c108").Value = CheckBox13.Caption
masquage13 = False
Else
Range("c108").Value = ""
masquage13 = True
End If
End Sub
Private Sub CheckBox2_Click()
If CheckBox2.Value = True Then
Range("c44").Value = CheckBox2.Caption
masquage2 = False
Range("e7,e8,e9,e31").Interior.ColorIndex = 6
Else
Range("c44").Value = ""
masquage2 = True
Range("e7,e8,e9,e31").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox3_Click()
If CheckBox3.Value = True Then
Range("c50").Value = CheckBox3.Caption
masquage3 = False
Else
Range("c50").Value = ""
masquage3 = True
End If
End Sub
Private Sub CheckBox4_Click()
If CheckBox4.Value = True Then
Range("c56").Value = CheckBox4.Caption
Range("e10,e11,e31").Interior.ColorIndex = 6
masquage4 = False
Else
Range("c56").Value = ""
masquage4 = True
Range("e10,e11,e31").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox5_Click()
If CheckBox5.Value = True Then
Range("c61").Value = CheckBox5.Caption
masquage5 = False
Else
Range("c61").Value = ""
masquage5 = True
End If
End Sub
Private Sub CheckBox6_Click()
If CheckBox6.Value = True Then
Range("c68").Value = CheckBox6.Caption
masquage6 = False
Else
Range("c68").Value = ""
masquage6 = True
End If
End Sub
Private Sub CheckBox7_Click()
If CheckBox7.Value = True Then
Range("c73").Value = CheckBox7.Caption
masquage7 = False
Range("e12,e13,e14,e15,e16,e31").Interior.ColorIndex = 6
Worksheets(1).Cells(14, 5) = ""
Else
Range("c73").Value = ""
masquage7 = True
Range("e12,e13,e14,e15,e16,e31").Interior.ColorIndex = xlNone
Worksheets(1).Cells(14, 5) = 1
End If
End Sub
Private Sub CheckBox8_Click()
If CheckBox8.Value = True Then
Range("c81").Value = CheckBox8.Caption
masquage8 = False
Range("e23,e24,e25,e26,e31").Interior.ColorIndex = 6
Worksheets(1).Cells(24, 5) = ""
Else
Range("c81").Value = ""
masquage8 = True
Range("e23,e24,e25,e26,e31").Interior.ColorIndex = xlNone
Worksheets(1).Cells(24, 5) = 1
End If
End Sub
Private Sub CheckBox9_Click()
If CheckBox9.Value = True Then
Range("c89").Value = CheckBox9.Caption
masquage9 = False
Range("e19,e22,e31").Interior.ColorIndex = 6
Else
Range("c89").Value = ""
masquage9 = True
Range("e19,e22,e31").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CommandButton1_Click()
If masquage1 = False Then
Rows("36:42").Hidden = False
Else
Range("i42").Value = ""
Rows("36:42").Hidden = True
End If
If masquage2 = False Then
Rows("43:48").Hidden = False
Else
Range("i48").Value = ""
Rows("43:48").Hidden = True
End If
If masquage3 = False Then
Rows("49:54").Hidden = False
Else
Rows("49:54").Hidden = True
End If
If masquage4 = False Then
Rows("55:59").Hidden = False
Else
Range("i59").Value = ""
Rows("55:59").Hidden = True
End If
If masquage5 = False Then
Rows("60:66").Hidden = False
Else
Rows("60:66").Hidden = True
End If
If masquage6 = False Then
Rows("67:71").Hidden = False
Else
Rows("67:71").Hidden = True
End If
If masquage7 = False Then
Rows("72:79").Hidden = False
Else
Range("i79").Value = ""
Rows("72:79").Hidden = True
End If
If masquage8 = False Then
Rows("80:87").Hidden = False
Else
Range("i87").Value = ""
Rows("80:87").Hidden = True
End If
If masquage9 = False Then
Rows("88:91").Hidden = False
Else
Range("i91").Value = ""
Rows("88:91").Hidden = True
End If
If masquage10 = False Then
Rows("92:98").Hidden = False
Else
Range("i98").Value = ""
Rows("92:98").Hidden = True
End If
If masquage11 = False Then
Rows("99:102").Hidden = False
Else
Rows("99:102").Hidden = True
End If
If masquage12 = False Then
Rows("103:106").Hidden = False
Else
masquage1 = True
Rows("103:106").Hidden = True
End If
If masquage13 = False Then
Rows("107:113").Hidden = False
Else
Rows("107:113").Hidden = True
End If
Unload Me
Hypothèses2.Show
End Sub
Jusque là, ça parait bien...Je lance la macro, Je clique sur certaines checkboxs, ça marche.Je relance, j'en clique d'autres et ça ne marche plus.Je suis obligée de cliquer - décliquer- recliquer chaque checkbox pour que mon tableau correspondent à mes choix.
Bon, je sais pas si c'est très clair, mais si quelqu'un a une idée, merci beaucoup.
A+, Alex
J'ai un petit problème avec un userform et je n'arrive pas à comprendre d'où ça vient. Voilà mes procédures:
Private Sub CheckBox1_Click()
If CheckBox1.Value = True Then
Range("c37").Value = CheckBox1.Caption
Range("e6,e7,e8,e31").Interior.ColorIndex = 6
masquage1 = False
Else
Range("c37").Value = ""
Range("e6,e7,e8,e31").Interior.ColorIndex = xlNone
masquage1 = True
End If
End Sub
Private Sub CheckBox10_Click()
If CheckBox10.Value = True Then
Range("c93").Value = CheckBox10.Caption
masquage10 = False
Range("e17,e18,e20,e21,e31").Interior.ColorIndex = 6
Worksheets(1).Cells(18, 5) = ""
Else
Range("c93").Value = ""
masquage10 = True
Range("e17,e18,e20,e21,e31").Interior.ColorIndex = xlNone
Worksheets(1).Cells(18, 5) = 1
End If
End Sub
Private Sub CheckBox11_Click()
If CheckBox11.Value = True Then
Range("c100").Value = CheckBox11.Caption
masquage11 = False
Range("e27").Interior.ColorIndex = 6
Else
Range("c100").Value = ""
masquage11 = True
Range("e27").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox12_Click()
If CheckBox12.Value = True Then
Range("c104").Value = CheckBox12.Caption
masquage12 = False
Range("e6,e28").Interior.ColorIndex = 6
Else
Range("c104").Value = ""
masquage12 = True
Range("e6,e28").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox13_Click()
If CheckBox13.Value = True Then
Range("c108").Value = CheckBox13.Caption
masquage13 = False
Else
Range("c108").Value = ""
masquage13 = True
End If
End Sub
Private Sub CheckBox2_Click()
If CheckBox2.Value = True Then
Range("c44").Value = CheckBox2.Caption
masquage2 = False
Range("e7,e8,e9,e31").Interior.ColorIndex = 6
Else
Range("c44").Value = ""
masquage2 = True
Range("e7,e8,e9,e31").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox3_Click()
If CheckBox3.Value = True Then
Range("c50").Value = CheckBox3.Caption
masquage3 = False
Else
Range("c50").Value = ""
masquage3 = True
End If
End Sub
Private Sub CheckBox4_Click()
If CheckBox4.Value = True Then
Range("c56").Value = CheckBox4.Caption
Range("e10,e11,e31").Interior.ColorIndex = 6
masquage4 = False
Else
Range("c56").Value = ""
masquage4 = True
Range("e10,e11,e31").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CheckBox5_Click()
If CheckBox5.Value = True Then
Range("c61").Value = CheckBox5.Caption
masquage5 = False
Else
Range("c61").Value = ""
masquage5 = True
End If
End Sub
Private Sub CheckBox6_Click()
If CheckBox6.Value = True Then
Range("c68").Value = CheckBox6.Caption
masquage6 = False
Else
Range("c68").Value = ""
masquage6 = True
End If
End Sub
Private Sub CheckBox7_Click()
If CheckBox7.Value = True Then
Range("c73").Value = CheckBox7.Caption
masquage7 = False
Range("e12,e13,e14,e15,e16,e31").Interior.ColorIndex = 6
Worksheets(1).Cells(14, 5) = ""
Else
Range("c73").Value = ""
masquage7 = True
Range("e12,e13,e14,e15,e16,e31").Interior.ColorIndex = xlNone
Worksheets(1).Cells(14, 5) = 1
End If
End Sub
Private Sub CheckBox8_Click()
If CheckBox8.Value = True Then
Range("c81").Value = CheckBox8.Caption
masquage8 = False
Range("e23,e24,e25,e26,e31").Interior.ColorIndex = 6
Worksheets(1).Cells(24, 5) = ""
Else
Range("c81").Value = ""
masquage8 = True
Range("e23,e24,e25,e26,e31").Interior.ColorIndex = xlNone
Worksheets(1).Cells(24, 5) = 1
End If
End Sub
Private Sub CheckBox9_Click()
If CheckBox9.Value = True Then
Range("c89").Value = CheckBox9.Caption
masquage9 = False
Range("e19,e22,e31").Interior.ColorIndex = 6
Else
Range("c89").Value = ""
masquage9 = True
Range("e19,e22,e31").Interior.ColorIndex = xlNone
End If
End Sub
Private Sub CommandButton1_Click()
If masquage1 = False Then
Rows("36:42").Hidden = False
Else
Range("i42").Value = ""
Rows("36:42").Hidden = True
End If
If masquage2 = False Then
Rows("43:48").Hidden = False
Else
Range("i48").Value = ""
Rows("43:48").Hidden = True
End If
If masquage3 = False Then
Rows("49:54").Hidden = False
Else
Rows("49:54").Hidden = True
End If
If masquage4 = False Then
Rows("55:59").Hidden = False
Else
Range("i59").Value = ""
Rows("55:59").Hidden = True
End If
If masquage5 = False Then
Rows("60:66").Hidden = False
Else
Rows("60:66").Hidden = True
End If
If masquage6 = False Then
Rows("67:71").Hidden = False
Else
Rows("67:71").Hidden = True
End If
If masquage7 = False Then
Rows("72:79").Hidden = False
Else
Range("i79").Value = ""
Rows("72:79").Hidden = True
End If
If masquage8 = False Then
Rows("80:87").Hidden = False
Else
Range("i87").Value = ""
Rows("80:87").Hidden = True
End If
If masquage9 = False Then
Rows("88:91").Hidden = False
Else
Range("i91").Value = ""
Rows("88:91").Hidden = True
End If
If masquage10 = False Then
Rows("92:98").Hidden = False
Else
Range("i98").Value = ""
Rows("92:98").Hidden = True
End If
If masquage11 = False Then
Rows("99:102").Hidden = False
Else
Rows("99:102").Hidden = True
End If
If masquage12 = False Then
Rows("103:106").Hidden = False
Else
masquage1 = True
Rows("103:106").Hidden = True
End If
If masquage13 = False Then
Rows("107:113").Hidden = False
Else
Rows("107:113").Hidden = True
End If
Unload Me
Hypothèses2.Show
End Sub
Jusque là, ça parait bien...Je lance la macro, Je clique sur certaines checkboxs, ça marche.Je relance, j'en clique d'autres et ça ne marche plus.Je suis obligée de cliquer - décliquer- recliquer chaque checkbox pour que mon tableau correspondent à mes choix.
Bon, je sais pas si c'est très clair, mais si quelqu'un a une idée, merci beaucoup.
A+, Alex