I'm using the code below and today's date is pre-populated in the Input box. Is there a way to make it today() - 7 days?
thanks!
thanks!
Code:
[I]Sub DeleteFromDate()
[/I]Application.ScreenUpdating = FalseApplication.DisplayAlerts = False
Dim LR As Long
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
DateR = Application.InputBox("Enter based on date to delete", TitleMsg, FormatDateTime(Date, vbShortDate), Type:=1)
Cells.AutoFilter Field:=2, Criteria1:="<=" & DateR
ALR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
If ALR > 2 Then
Range("A2:A" & LR).SpecialCells(xlCellTypeVisible).Select
Range("A2:A" & LR).Delete
Range("A1").Activate
End If
Cells.AutoFilter
MsgBox "Finished deleting rows"
Application.DisplayAlerts = True
Application.ScreenUpdating = True [I]End Sub[/I]