XL 2016 Probleme de DATE_DIFF

KTM

XLDnaute Impliqué
Bonjour chers tous
Dans ma base de Donnee j'aimerais extraire les Clients dont l'echeance est arrivée il ya 28 jours.
Pour cela jai fais cette macro mais il semble avoir un soucis avec la syntaxe "datedif"

Sub tri()
Dim X As Variant
With ActiveSheet
.[E4] = "X"
.Range("E5:E" & .Range("B" & Rows.Count).End(xlUp).Row).FormulaR1C1 = "=IF(AND(R2C3>RC[-1],DATEDIF(RC[-1],R2C3,""d"")>=28),1,0)"
.Range("B5:E" & .Range("B" & Rows.Count).End(xlUp).Row).Sort key1:=.Range("E5"), order1:=xlDescending
X = Application.Match(0, .Range("E5:E" & .Range("B" & Rows.Count).End(xlUp).Row), 0)
If .Range("E" & Rows.Count).End(xlUp).Row >= 2 Then
If Not IsError(X) Then .Range("B" & X & ":E" & .Range("B" & Rows.Count).End(xlUp).Row + 1).Delete xlShiftUp
End If
.Range("E4:E" & .Range("B" & Rows.Count).End(xlUp).Row + 1).ClearContents
End With
End Sub


Pouvez vous m'aider a rediger correctement cette Macro ? Merci.
 

Pièces jointes

  • DifferenceDate.xlsm
    17.7 KB · Affichages: 11