I am a rookie with VBA. The following VBA code successfully strips out all rows earlier than 1/1/2017 but only for the active worksheet. I have 30 worksheets in the workbook/file I would like to strip out all earlier dates. I have tried to modify the sequence based on other examples gleaned through internet searches but have come up short. How do I modify VBA code here to capture all the worksheets? Many thanks!!
Sub DeleteFromDate()
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim LR As Long
LR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
Cells.AutoFilter Field:=1, Criteria1:="<1/1/2017"
ALR = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
If ALR > 2 Then
Range("A3:A" & LR).SpecialCells(xlCellTypeVisible).Select
Range("A3:A" & LR).Delete
Range("A1").Activate
End If
Cells.AutoFilter
MsgBox "All Finished deleting rows"
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
Bookmarks