I have the following code to delete old data from my archived sheets after 730 days have passed, but it is not working. When I use the button nothing happens. I have attached a screen shot of my workbook. I need the button to delete rows, starting at row 4 and moving down the worksheet for an infinite amount of rows, that have a roll off date greater then 730 days. Any help will be greatly appreciated.
Sub DeleteCells()
Dim lr As Long, I As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
lr = Range("D" & Rows.Count).End(xlUp).Row
For I = lr To 1 Step -4
If Range("A" & I).Value <= Date - 730 Then Rows(I).Delete
Next I
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
Sub DeleteCells()
Dim lr As Long, I As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
lr = Range("D" & Rows.Count).End(xlUp).Row
For I = lr To 1 Step -4
If Range("A" & I).Value <= Date - 730 Then Rows(I).Delete
Next I
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub