Bonjour
C'est encore moi.
J'ai cette macro pour vérifier les échéances à venir. Comme toujours, une erreur se glisse dans le code que je maitrise, certes, très mal :
Sub alerte()
Dim w1 As Worksheet
Dim i As Long
Dim D As Date
Dim j As Integer
Set w1 = Worksheets("Effectif") 'Feuille qui contient les alertes
D = Date
' ********************************* fin de CMU
For i = 2 To w1.Range("T" & Rows.Count).End(xlUp).Row
p = D - w1.Range("T" & i)
If p >= 0 Then MsgBox ("La CMU pour " & Cells(i, "C").Value & " à déja expirée depuis le : " & Cells(i, "T").Value)
If p > -7 And p < 0 Then MsgBox ("La CMU pour ce jeune expirera le" & Cells(i, "T").Value)
Next i
' ********************************* fin d'ATJM
For i = 2 To w1.Range("Z" & Rows.Count).End(xlUp).Row
p = D - w1.Range("Z" & i)
If p >= 0 Then MsgBox ("L'ATJM pour " & Cells(i, "C").Value & " à déja expirée depuis le : " & Cells(i, "Z").Value)
If p > -7 And p < 0 Then MsgBox ("Fin d'ATJM pour " & Cells(i, "C").Value)
Next i
' ********************************* Fin d'autorisation de travail
For i = 2 To w1.Range("AM" & Rows.Count).End(xlUp).Row
p = D - w1.Range("AM" & i)
If p >= 0 Then MsgBox ("l'autorisation de travail pour : " & Cells(i, "C").Value & " à déja expirée depuis le : " & Cells(i, "F").Value)
Next i
End Sub