I don't like to put a lot of processing code into the WB Open event (personal choice)
This I put into a standard module, and just have the WB Open call it
I assumed anything over 365 days is to be deleted (i.e. No Leap Years)
Option Explicit
Sub RemoveOldData()
Dim ws As Worksheet
Dim rBottomOfData As Range
Dim iRow As Long
Application.ScreenUpdating = False
For Each ws In ThisWorkbook.Worksheets
With ws
If .Range("B5").Value <> "DATE" Then GoTo GetNextRow
Set rBottomOfData = .Cells(.Rows.Count, 2).End(xlUp)
'when deleting, start from bottom and work your way up
For iRow = rBottomOfData.Row To 6 Step -1
Application.StatusBar = "Checking worksheet '" & .Name & "' Row Number = " & Format(iRow, "#,##0")
If Not IsDate(.Cells(iRow, 2).Value) Then GoTo GetNextRow
If CLng(Now) - CLng(.Cells(iRow, 2).Value) > 365 Then
'for testing
.Cells(iRow, 2).Interior.Color = vbRed
'for real
'commented out .Rows(iRow).Delete
End If
GetNextRow:
Next iRow
End With
Next
Application.StatusBar = False
Application.ScreenUpdating = True
End Sub
Paul