Private Sub Worksheet_Change(ByVal Target As Range)
Dim resultat As String
Sheets("Gestionnaire audit").Unprotect ("mdp")
If Not Intersect(Target, Range("G6:G905")) Is Nothing Then
'instructions
resultat = InputBox("Veuillez indiquer dans le champ ci-dessous le XXXXXXXXXXX", "saisie écart(s) audit", "0")
ActiveCell.Offset(-1, 4).Value = resultat
End If
Dim cell As Range
For Each cell In Range("G6:G905")
If cell = "" And cell.Offset(0, -1) <> "" And cell.Offset(0, -5) <> 1 And cell.Offset(0, 5) <> "" Then
Dim Rep As Integer
Rep = msgbox("Le prochain XXXXXXXX" & cell.Offset(0, -3) & " au XXX" & cell.Offset(0, -2) & " prévu le " & cell.Offset(0, 5) & " doit être réalisé par XXXXXXXXXXX." & Chr(10) & Chr(10) & " - cliquer sur OK pour prévenir par E-mail votre partenaire XXXXX." _
& Chr(10) & Chr(10) & " - cliquer sur annuler pour sortir de la procédure ", vbOKCancel + vbInformation, "Information")
If Rep = vbOK Then
' ici le traitement si réponse positive
cell.Offset(0, -5) = 1
Call Mail_auto
Else
' ici le traitement si réponse négative
Exit Sub
End If
End If
Next
End Sub