XL 2016 Alerte excel

marc94600

XLDnaute Occasionnel
Bonjour,
Dans mon tableau je souhaiterai qu'il y ait une alerte lorsque la date de fin d'habilitation d'une société (-1 an) arrive à expiration.
dans mon tableau feuille HPM_ARCHIVES colonne AZ.
Les données du tableau sont fictives.
Merci à vous
Bien cordialement
Marc
 

Pièces jointes

  • DOUBLONS 03-04-2024.xlsx
    40.2 KB · Affichages: 6
Solution
Bonjour marc94600, le fil,

Je n'avais pas vu passer :
L'alerte devra intervenir à H-365 jours.
Il faut donc décaler les alertes d'un an, dans ThisWorkbook :
VB:
Private Sub Workbook_Open()
Dim c As Range
With Sheets("HPM_ARCHIVES")
    For Each c In .Range("AY2", .Range("AY" & .Rows.Count).End(xlUp))
        If IsDate(c) Then Application.OnTime DateSerial(Year(c) - 1, Month(c), Day(c)), "Alerte"
    Next
End With
End Sub
et dans Module1 :
VB:
Sub Alerte()
Dim c As Range
With Sheets("HPM_ARCHIVES")
    For Each c In .Range("AY2", .Range("AY" & .Rows.Count).End(xlUp))
        If IsDate(c) Then
            If DateSerial(Year(c) - 1, Month(c), Day(c)) <= Date And .Cells(c.Row, "BF") = "" Then...

job75

XLDnaute Barbatruc
Bonjour marc94600, le fil,

Je n'avais pas vu passer :
L'alerte devra intervenir à H-365 jours.
Il faut donc décaler les alertes d'un an, dans ThisWorkbook :
VB:
Private Sub Workbook_Open()
Dim c As Range
With Sheets("HPM_ARCHIVES")
    For Each c In .Range("AY2", .Range("AY" & .Rows.Count).End(xlUp))
        If IsDate(c) Then Application.OnTime DateSerial(Year(c) - 1, Month(c), Day(c)), "Alerte"
    Next
End With
End Sub
et dans Module1 :
VB:
Sub Alerte()
Dim c As Range
With Sheets("HPM_ARCHIVES")
    For Each c In .Range("AY2", .Range("AY" & .Rows.Count).End(xlUp))
        If IsDate(c) Then
            If DateSerial(Year(c) - 1, Month(c), Day(c)) <= Date And .Cells(c.Row, "BF") = "" Then
                MsgBox "Echéance " & .Cells(c.Row, "B") & " " & c
                .Cells(c.Row, "BF") = "X"
            End If
        End If
    Next
End With
End Sub
A+
 

Pièces jointes

  • DOUBLONS 03-04-2024.xlsm
    57.9 KB · Affichages: 3

Statistiques des forums

Discussions
312 247
Messages
2 086 590
Membres
103 247
dernier inscrit
bottxok