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
| Option Explicit
Sub MiseEnFormeCond()
Dim TabFeuil As Variant
Dim Sh As Worksheet
Dim stChaine
TabFeuil = Array("Réunion R1", "Réunion R2", "Réunion R3")
Application.ScreenUpdating = False
For Each Sh In Sheets(TabFeuil)
With Sh.Range("E3:N65000")
'Supprime les MFC existantes
.FormatConditions.Delete
'***************************************************************************
'Si Rien
'***************************************************************************
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=0"
With .FormatConditions(1)
'Définit la couleur de fond de la cellule lorsque la condition sera vraie.
.Interior.Pattern = xlNone
.Interior.TintAndShade = 0
End With
'***************************************************************************
'Pour le 1er de l'arrivée
'***************************************************************************
'Ajoute une condition (Vrai lorsque la cellule est égal à)
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=$O3"
With .FormatConditions(2)
'Définit la couleur de fond de la cellule lorsque la condition sera vraie.
.Interior.Color = RGB(112, 48, 160)
.Interior.PatternColorIndex = xlAutomatic
'Affecte le style "gras" à la police
.Font.Bold = True
.Font.Color = RGB(255, 0, 0)
'Voir aussi:
'.Font.Italic = True
'.Font.Strikethrough = True
'.Font.Underline = True
'Styles de ligne:
'xlNone, xlSolid, xlDash, xlDot, xlDashDot, xlDashDotDot, xlGray50, xlGray75, et xlGray25.
'.Borders.LineStyle = xlContinuous
End With
'***************************************************************************
'Pour le 2eme de l'arrivée
'***************************************************************************
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=$P3"
With .FormatConditions(3)
'Définit la couleur de fond de la cellule lorsque la condition sera vraie.
.Interior.Color = RGB(146, 208, 80)
.Interior.PatternColorIndex = xlAutomatic
'Affecte le style "gras" à la police
.Font.Bold = True
.Font.Color = RGB(0, 0, 0)
End With
'***************************************************************************
'Pour le 3eme de l'arrivée
'***************************************************************************
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=$Q3"
With .FormatConditions(4)
'Définit la couleur de fond de la cellule lorsque la condition sera vraie.
.Interior.Color = RGB(155, 194, 230)
.Interior.PatternColorIndex = xlAutomatic
'Affecte le style "gras" à la police
.Font.Bold = True
.Font.Color = RGB(0, 0, 0)
End With
'***************************************************************************
'Pour le 4eme de l'arrivée
'***************************************************************************
.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=$R3"
With .FormatConditions(5)
'Définit la couleur de fond de la cellule lorsque la condition sera vraie.
.Interior.Color = RGB(255, 217, 102)
.Interior.PatternColorIndex = xlAutomatic
'Affecte le style "gras" à la police
.Font.Bold = True
.Font.Color = RGB(0, 0, 0)
End With
End With
With Sh.Range("O3:S650000")
.Font.Bold = True
.HorizontalAlignment = xlCenter
End With
With Sh.Range("T3:AD65000")
'.NumberFormat = "0.00"
.NumberFormat = "@"
End With
Next Sh
Application.ScreenUpdating = True
End Sub |
Partager