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
| Sub MFC()
Application.ScreenUpdating = False
Set Plage = Range("D16:D26") 'MFC 1
For Lig = 5 To 115 Step 11
Col = 4
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
For compteur = 1 To 28
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=" & Cells(Lig + 4, Col).Address & "=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.Color = RGB(255, 128, 255)
End With
Selection.FormatConditions(1).StopIfTrue = True
ActiveCell.Offset(0, 7).Select
Col = Col + 7
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
Next compteur, Lig
Set Plage = Range("D16:D26") 'MFC 2
For Lig = 5 To 115 Step 11
Col = 5
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
For compteur = 1 To 28
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=" & Cells(Lig + 3, Col).Address & "=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.Color = RGB(0, 128, 0)
End With
Selection.FormatConditions(1).StopIfTrue = True
ActiveCell.Offset(0, 7).Select
Col = Col + 7
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
Next compteur, Lig
Set Plage = Range("D16:D26") 'MFC 3
For Lig = 5 To 115 Step 11
Col = 6
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
For compteur = 1 To 28
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=" & Cells(Lig + 2, Col).Address & "=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.Color = RGB(0, 128, 224)
End With
Selection.FormatConditions(1).StopIfTrue = True
ActiveCell.Offset(0, 7).Select
Col = Col + 7
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
Next compteur, Lig
Set Plage = Range("D16:D26") 'MFC 4
For Lig = 5 To 115 Step 11
Col = 7
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
For compteur = 1 To 28
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=" & Cells(Lig + 10, Col).Address & "=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.Color = RGB(192, 32, 64)
End With
Selection.FormatConditions(1).StopIfTrue = True
ActiveCell.Offset(0, 7).Select
Col = Col + 7
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
Next compteur, Lig
Set Plage = Range("D16:D26") 'MFC 5
For Lig = 5 To 115 Step 11
Col = 8
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
For compteur = 1 To 28
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=" & Cells(Lig + 7, Col).Address & "=1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.Color = RGB(160, 64, 255)
End With
Selection.FormatConditions(1).StopIfTrue = True
ActiveCell.Offset(0, 7).Select
Col = Col + 7
Set Plage = Range(Cells(Lig, Col), Cells(Lig + 10, Col))
Plage.Select
Next compteur, Lig
End Sub |