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
| sub Alerte ()
Dim w1 As Worksheet
Dim i As Long
Dim Z As Long
Dim D As Date
Set w1 = Sheets("ALERTE") 'Feuille qui contient les alertes : A adapter si nécessaire
D = Date
For i = 2 To w1.Range("A" & Rows.Count).End(xlUp).Row ' faire toute la colonne A
p = D - w1.Range("A" & i)
If p > -7 And p <= 0 Then
MsgBox w1.Range("A" & i) & ":" & " " & w1.Range("B" & i)
End If
Next
'supprimer taches expirées
Application.ScreenUpdating = False
For Z = w1.Range("A" & Rows.Count).End(xlUp).Row To 2 Step -1
If IsDate(w1.Cells(Z, 1)) Then
If CDate(w1.Cells(Z, 1)) < D Then
If MsgBox("Etes-vous sûr de vouloir effacer la tache : " & w1.Range("A" & Z) & " : " & w1.Range("B" & Z), vbExclamation + vbYesNo) = vbYes Then
w1.Cells(Z, 1).EntireRow.Delete
End If
End If
End If
Next Z
End sub |
Partager