Hi,
I've got some simple code, that I can get to work on one sheet quite well. It removes any rows with date in Column "K" that are over 180 days in the future. I need to run it across all the sheets in my workbook, with the exceptions of "Master", "Exceptions", "Unlimited" and "Closed"
I've tried this:
Sub Remove180Loop()
Dim ws As Worksheet
Dim i As Integer
Dim Lastrow As Long, x As Long
For Each ws In ActiveWorkbook.Worksheets
For i = 1 To Sheets.Count
If Worksheets(i).Name <> "Master" Or Worksheets(i).Name <> "Exceptions" Or _
Worksheets(i).Name <> "Unlimited" Or Worksheets(i).Name <> "Closed" Then
Lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).row
For x = Lastrow To 5 Step -1
If Cells(x, "K").Value > Date + 180 Then Rows(x).Delete
Next
End If
Next I
Next ws
End Sub
It still works on the first sheet, but won't loop through the book. Any help would be great.
Bookmarks