Bjr à tous,
accrochez vous bien je sais pas si j'arriverais à expliquer !
J'ai un calendrier mois par feuilles excel, avec un bouton j'ouvre 1 formulaire, avec ce formulaire je peut choisir des mois et des jour (matin ou après midi)
Tout ca est fait en cache a cocher (les carrés) qui permettent donc plusieurs choix!
Donc avec ce formulaire, je vais "colorer" les jours que j'ai choisi sur les bonne feuilles. Ca va jusque la !?

Mes problèmes :
- Mon code marche pour lundi, mardi et mercredi, mais jeudi et vendredi ne fonctionne que si les autres jours sont en commentaire et donc inexistant. Avec le débugage, j'ai constaté qu'il passait par les "matin" de tout les jours alors qu'il ne devrais pas si la case n'est pa cocher.
- Ceci fonctionne uniquement pour un seul jour, sur un seul mois, et je veux pouvoir le faire sur tous.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
102
103
104
Sub joursemaine ()
    If obt_lundiM.Value = True & obt_LundiAP.Value = True Then
    ' grise les lundis
        Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=2)"
        Selection.FormatConditions(1).Interior.ColorIndex = 15
        Else
        If obt_lundiM.Value = True & obt_LundiAP.Value = False Then
        'grise les lundis après matin
            Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
            "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=2)"
            Selection.FormatConditions(1).Interior.ColorIndex = 15
            Else
            If obt_lundiM.Value = False & obt_LundiAP.Value = True Then
            ' grise les lundis après midi
                Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
                "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=2)"
                Selection.FormatConditions(1).Interior.ColorIndex = 15
            End If
        End If
    End If
    If obt_MardiM.Value = True & obt_MardiAP.Value = True Then
    'grise les mardis
        Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=3)"
        Selection.FormatConditions(1).Interior.ColorIndex = 15
        Else
        If obt_MardiM.Value = True & obt_MardiAP.Value = False Then
        'grise les mardis matin
            Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
            "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=3)"
            Selection.FormatConditions(1).Interior.ColorIndex = 15
            Else
            If obt_MardiM.Value = False & obt_MardiAP.Value = True Then
            'grise les mardis après midi
                Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
                "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=3)"
                Selection.FormatConditions(1).Interior.ColorIndex = 15
            End If
        End If
    End If
    If obt_MercrediM.Value = True & obt_mercrediAP.Value = True Then
        'grise les mercredis
        Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=4)"
        Selection.FormatConditions(1).Interior.ColorIndex = 15
        Else
        If obt_MercrediM.Value = True & obt_mercrediAP.Value = False Then
            'grise les mercredis matin
            Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
            "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=4)"
            Selection.FormatConditions(1).Interior.ColorIndex = 15
            Else
            If obt_MercrediM.Value = False & obt_mercrediAP.Value = True Then
                'grise les mercredis après midi
                Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
                "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=4)"
                Selection.FormatConditions(1).Interior.ColorIndex = 15
            End If
        End If
    End If
 
    If obt_JeudiM.Value = True & obt_JeudiAP.Value = True Then
        ' grise les jeudis
        Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=5)"
        Selection.FormatConditions(1).Interior.ColorIndex = 15
        Else
        If obt_JeudiM.Value = True & obt_JeudiAP.Value = False Then
            'grise les jeudis matin
            Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
            "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=5)"
            Selection.FormatConditions(1).Interior.ColorIndex = 15
            Else
            If obt_JeudiM.Value = False & obt_JeudiAP.Value = True Then
                'grise les jeudis après midi
                Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
                "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=5)"
                Selection.FormatConditions(1).Interior.ColorIndex = 15
            End If
        End If
    End If
 
    If obt_VendrediM = True & obt_vendrediAP.Value = True Then
        'grise les vendredis
        Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=6)"
        Selection.FormatConditions(1).Interior.ColorIndex = 15
        Else
        If obt_VendrediM.Value = True & obt_vendrediAP.Value = False Then
            'grise les vendrdis matin
            Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
            "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=6)"
            Selection.FormatConditions(1).Interior.ColorIndex = 15
            Else
            If obt_VendrediM.Value = False & obt_vendrediAP.Value = True Then
                'grise les vendredis après midi
                Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
                "=OU(JOURSEM(B$5)=1;JOURSEM(B$5)=7;JOURSEM(B$5)=6)"
                Selection.FormatConditions(1).Interior.ColorIndex = 15
            End If
        End If
    End If
End Sub
Si c'est pas assez clair dite le moi.
Merci de votre aide !