Sub Anniversaires()
Dim t, i&, dat As Date, dat1 As Date, dat2 As Date, n&
t = [A1].CurrentRegion.Resize(, 4)
For i = 2 To UBound(t)
If IsDate(t(i, 3)) Then
dat = CDate(t(i, 3))
dat1 = DateSerial(Year(Date), Month(dat), Day(dat))
dat2 = DateSerial(Year(Date) + 1, Month(dat), Day(dat))
If dat1 >= Date And dat1 < Date + 30 Then
n = n + 1
t(n, 1) = t(i, 1): t(n, 2) = t(i, 2)
t(n, 3) = dat: t(n, 4) = dat1
ElseIf dat2 < Date + 30 Then
n = n + 1
t(n, 1) = t(i, 1): t(n, 2) = t(i, 2)
t(n, 3) = dat: t(n, 4) = dat2
End If
End If
Next
If n Then
With [AA:AD].Resize(n)
.Value = t
.Sort [AD1], xlAscending, Header:=xlNo 'tri sur 4ème colonne
UserForm1.ListBox1.List = .Value
.ClearContents
End With
End If
UserForm1.Show
End Sub