Sub DeleteOlderThanSeven()
Dim lR As Long, R As Range, i As Long
lR = Range("L" & Rows.Count).End(xlUp).Row
Set R = Range("L1:L" & lR)
Application.ScreenUpdating = False
For i = lR To 1 Step -1
If IsDate(R.Cells(i)) Then
If Date - R.Cells(i).Value > 7 Then
R.Rows(i).EntireRow.Delete
End If
End If
Next i
Application.ScreenUpdating = True
End Sub
Sub DeleteRows()
Dim Rang As Range
Dim Cell As Range
Dim Arr() As Long
Dim Num As Long
Dim i As Long
With ActiveSheet 'change as necessary
Set Rang = Intersect( _
.Columns("L"), _
.UsedRange)
End With
Num = 0
For Each Cell In Rang
If IsDate(Cell.Value) Then
If Cell.Value < Date - 7 Then
Num = Num + 1
ReDim Preserve Arr(1 To Num)
Arr(Num) = Cell.Row
End If
End If
Next Cell
For i = Num To 1 Step -1
ActiveSheet.Rows(Arr(i)).Delete
Next i
End Sub
Did you install the code as a worksheet module or a standard module? Are your "dates" actual dates (i.e. numbers) or are they text?Hmmm...neither are working.