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
|
Sub Ecart(ByVal checkBoxName As String, ByVal targetCellAddress As String)
Dim chkBox As CheckBox
Dim targetRange As Range
' Définit la case à cocher spécifiée
Set chkBox = ActiveSheet.CheckBoxes(checkBoxName)
' Définit la plage cible spécifiée
Set targetRange = Range(targetCellAddress)
' Vérifie l'état de la case à cocher
If chkBox.Value = 1 Then
' Si la case à cocher est cochée, applique la couleur
targetRange.Interior.Color = RGB(190, 190, 190) ' Changez la couleur selon vos besoins
Else
' Si la case à cocher est décochée, supprime la couleur
targetRange.Interior.ColorIndex = xlNone
End If
End Sub
Sub CaseEcart()
' Appel de la procédure Ecart avec les configurations spécifiques
Ecart "Check Box 50", "C4"
Ecart "Check Box 95", "C5"
Ecart "Check Box 97", "C6"
Ecart "Check Box 98", "C7"
Ecart "Check Box 100", "C8"
Ecart "Check Box 101", "C11"
Ecart "Check Box 102", "C12"
Ecart "Check Box 103", "C13"
Ecart "Check Box 104", "C14"
Ecart "Check Box 105", "C15"
Ecart "Check Box 106", "C18"
Ecart "Check Box 107", "C19"
Ecart "Check Box 108", "C20"
Ecart "Check Box 109", "C21"
Ecart "Check Box 110", "C22"
Ecart "Check Box 111", "C25"
Ecart "Check Box 112", "C26"
Ecart "Check Box 113", "C27"
Ecart "Check Box 114", "C28"
Ecart "Check Box 115", "C29"
Ecart "Check Box 116", "C32"
Ecart "Check Box 117", "C33"
Ecart "Check Box 118", "C34"
Ecart "Check Box 119", "C35"
Ecart "Check Box 120", "C36"
Ecart "Check Box 121", "C39"
Ecart "Check Box 122", "C40"
Ecart "Check Box 123", "C41"
Ecart "Check Box 124", "C42"
Ecart "Check Box 125", "C43"
End Sub |
Partager