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 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154
| Private Sub Worksheet_Change(ByVal Target As Range) 'au changement dans l'onglet
Dim PL As Range
Dim CEL As Range
Dim T As Boolean
Set PL = Application.Union(Range("I12:I23"), Range("N12:O23"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(12, 18)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(12, 18).Select: Exit Sub
T = False
End If
Set PL = Range("K12:K23")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(12, 21)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(12, 21)(1).Select: Exit Sub
T = False
End If
Set PL = Range("M12:O23")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(12, 23)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(12, 23)(1).Select: Exit Sub
T = False
End If
Set PL = Range("H24:I31")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(24, 18)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(24, 18)(1).Select: Exit Sub
T = False
End If
Set PL = Range("J24:K31")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(24, 21)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(24, 21)(1).Select: Exit Sub
T = False
End If
Set PL = Range("L24:M31")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(24, 23)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(24, 23)(1).Select: Exit Sub
T = False
End If
Set PL = Union(Range("H32:I43"), Range("N32:N43"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(32, 18)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(32, 18)(1).Select: Exit Sub
T = False
End If
Set PL = Application.Union(Range("J32:K43"), Range("N32:N43"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(32, 21)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(32, 21)(1).Select: Exit Sub
T = False
End If
Set PL = Range("L32:N43")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(32, 23)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(32, 23)(1).Select: Exit Sub
T = False
End If
Set PL = Application.Union(Range("H44:I55"), Range("N44:O55"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(44, 18)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(44, 18)(1).Select: Exit Sub
T = False
End If
Set PL = Application.Union(Range("J44:K55"), Range("N44:O55"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(44, 21)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(44, 21)(1).Select: Exit Sub
T = False
End If
Set PL = Range("L44:O55")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(44, 23)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(44, 23)(1).Select: Exit Sub
T = False
End If
Set PL = Application.Union(Range("H56:I91"), Range("N56:P91"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(56, 18)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(56, 18)(1).Select: Exit Sub
T = False
End If
Set PL = Application.Union(Range("J56:K91"), Range("N56:P91"))
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(56, 21)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(56, 21)(1).Select: Exit Sub
T = False
End If
Set PL = Range("L56:P61")
If Not Application.Intersect(Target, PL) Is Nothing Then
For Each CEL In PL
If CEL(1).Value = "NA" Then T = True: Exit For
Next CEL
If T = False And Cells(56, 23)(1).Value < 3 Then MsgBox "Veuillez saisir une ligne évènement": Cells(56, 23)(1).Select: Exit Sub
T = False
End If
If Application.Intersect(Target, Range("B4:B6")) Is Nothing Then Exit Sub 'si le changement a lieu ailleurs que dans la plage B4:B6, sort de la procédure
Select Case Target.Value 'agit en fonction de la valeur de la cellule éditée
Case "1BCDFR" 'cas "1BCDFR"
Target.Offset(0, 1).Value = "FFFFFFF" 'modifie la cellue adjacente en colonne C
Case "1CCDRE" 'cas "1CCDRE"
Target.Offset(0, 1).Value = "FFFFFFFE" 'modifie la cellue adjacente en colonne C
Case "1DCDRF" 'cas "1DCDRF"
Target.Offset(0, 1).Value = "MMMMMM" 'modifie la cellue adjacente en colonne C
Case "1ETRGF" 'cas "1ETRGF"
Target.Offset(0, 1).Value = "CCCCCCC" 'modifie la cellue adjacente en colonne C
Case "1FTYHG" 'cas "1FTYHG"
Target.Offset(0, 1).Value = "NNNNNNN" 'modifie la cellue adjacente en colonne C
End Select 'fin de l'action en fonction de la valeur de la cellule éditée
End Sub |