Deleting Rows with a macro based on a date value
Try the below macro which works on the active sheet
Sub MyMacro()
Dim lngRow As Long
For lngRow = Cells(Rows.Count, "E").End(xlUp).Row To 2 Step -1
If Range("E" & lngRow) Date + 7 Then Rows(lngRow).Delete
Next
End Sub
If this post helps click Yes
---------------
Jacob Skaria
"Max2073" wrote:
I have a spreadsheet with 8000 rows. In column E I have dates (estimated
completion dates) - I would like to delete rows that are are not due within
the next seven days and/or which are not overdue.
eg. Today - 7 September 2009 - I would like to leave all rows that are due
upto the 14 September 2009 (left in the spreadsheet would be any outstanding
records that are overdue eg. 10 August 2009.
|