Hi
I have a spreadsheet which contains 13 columns, one of which is a start date (column D). The spreadsheet will contain rows with varying start dates and I need to remove all dates that are before yesterday's date except on Monday's when data for the previous Friday, Saturday and Sunday should remain in the spreadsheet.
I've tried adapting the code below for non-monday's, which I've been using to remove other data, but haven't managed to get anywhere (as my VB knowledge is almost non-existant) :-
Sub DeleteRowsBasedOnstartDate()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=3, Criteria1:="Today-1"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Any help would be gratefully appreciated
Thanks
Jules
I have a spreadsheet which contains 13 columns, one of which is a start date (column D). The spreadsheet will contain rows with varying start dates and I need to remove all dates that are before yesterday's date except on Monday's when data for the previous Friday, Saturday and Sunday should remain in the spreadsheet.
I've tried adapting the code below for non-monday's, which I've been using to remove other data, but haven't managed to get anywhere (as my VB knowledge is almost non-existant) :-
Sub DeleteRowsBasedOnstartDate()
With ActiveSheet
If .AutoFilterMode = False Then .Cells(1, 1).AutoFilter
.Range("A1").AutoFilter Field:=3, Criteria1:="Today-1"
.Range("A1").CurrentRegion.Offset(1, 0).SpecialCells _
(xlCellTypeVisible).EntireRow.Delete
.AutoFilterMode = False
End With
End Sub
Any help would be gratefully appreciated
Thanks
Jules