Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ligne As Integer '
With Sheets("Elaboration des contrats")
For ligne = 8 To .Range("A8").End(xlDown).Row
'-------------------------------------------------------------------------------
If .Range("E" & ligne).Value = "H07 - 2007 Hydraulique" And .Range("H" & ligne).Value <= 232 Then 'test sur première alerte
Cells(ligne, 5).Interior.ColorIndex = 44 'color la case en jaune/orange (alerte)
With Cells(ligne, 5).Validation
.Delete
.Add Type:=xlValidateInputOnly, AlertStyle:=xlValidAlertStop, Operator _
:=xlBetween
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = "Attention"
.ErrorTitle = ""
.InputMessage = "Attention, contrat H07 avec Pmax <= 232 kW => vérifier si compteur à courbe de charge télérelevé sinon signature avenant index installation hydraulique < 250 kVA"
.ErrorMessage = ""
.ShowInput = True
.ShowError = True
End With
Else
Cells(ligne, 5).Interior.ColorIndex = 2 'décolore la case si son contenu ne correspond plus
End If
'-------------------------------------------------------------------------------