Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With Sheets(1)
For i = 1 To .[c65000].End(xlUp).Row
If .Cells(i, 3).Value = "PERM" Then
Cells(i, "p").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells(i, "q").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
If .Cells(i, "i") = 0 Then MsgBox "Honoraire à 0 pour le candidat, ligne " & i: Cancel = True: Exit Sub
If .Cells(i, "x") = "" Then MsgBox "Mentionner Facturé/Potentiel pour le candidat, ligne " & i: Cancel = True: Exit Sub
If WorksheetFunction.Sum(.Range(.Cells(i, "y"), .Cells(i, "aj"))) = 0 Then MsgBox "Pas de donnée sur le détail par mois pour le candidat, ligne " & i: Cancel = True: Exit Sub
End If
Next i
End With
With Sheets(1)
For j = 1 To .[c65000].End(xlUp).Row
If .Cells(j, 3).Value = "TT" Then
Cells(j, "g").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells(j, "h").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
Cells(j, "i").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
If .Cells(j, "p") = 0 Then MsgBox "Coefficient à 0 pour le candidat, ligne " & j: Cancel = True: Exit Sub
If .Cells(j, "q") = 0 Then MsgBox "Taux de MB à 0 pour le candidat, ligne " & j: Cancel = True: Exit Sub
If .Cells(j, "x") = "" Then MsgBox "Mentionner Facturé/Potentiel pour le candidat, ligne " & j: Cancel = True: Exit Sub
If WorksheetFunction.Sum(.Range(.Cells(j, "y"), .Cells(j, "aj"))) = 0 Then MsgBox "Pas de donnée sur le détail par mois pour le candidat, ligne " & j: Cancel = True: Exit Sub
End If
Next j
End With
End Sub