Hi so i have a code that removes dates that are either less than the start date or more than the end date. I want to change the start from today instead of from 8 + days.
below is the code I have:
'next Tuesday as the start date
start_dt = CDate(Date + 8 - Weekday(Date, vbMonday))
' Tuesday in 2 weeks as the end date
end_dt = CDate(Date + 22 - Weekday(Date, vbTuesday))
'Delete items with dates beyond the dates
sh4.Activate
With sh4
For i = LastRow4 To 2 Step -1
If CDate(.Cells(i, 3).Value) < start_dt Or CDate(.Cells(i, 3).Value) > end_dt Then
.Rows(i).EntireRow.delete shift = xlUp
End If
With this code I thought I could change the start date from 8 to 0 but it still runs the same code and removes everything from before 8+ days.
could someone please advise how i could rearrange and change this code so that the start date is from the day i run it. (T0)
below is the code I have:
'next Tuesday as the start date
start_dt = CDate(Date + 8 - Weekday(Date, vbMonday))
' Tuesday in 2 weeks as the end date
end_dt = CDate(Date + 22 - Weekday(Date, vbTuesday))
'Delete items with dates beyond the dates
sh4.Activate
With sh4
For i = LastRow4 To 2 Step -1
If CDate(.Cells(i, 3).Value) < start_dt Or CDate(.Cells(i, 3).Value) > end_dt Then
.Rows(i).EntireRow.delete shift = xlUp
End If
With this code I thought I could change the start date from 8 to 0 but it still runs the same code and removes everything from before 8+ days.
could someone please advise how i could rearrange and change this code so that the start date is from the day i run it. (T0)