Hello ShaliniGomes,
The macro will now check if the contents of the cells in column "A" are dates. If the cell is not a date then it is ignored.
Sub Final_Cleanup()
Dim StartDate As Date, EndDate As Date
Dim i As Long
StartDate = DateSerial(Year(Date - 2), Month(Date - 2), Day(Date - 2))
EndDate = DateSerial(Year(Date), Month(Date), Day(Date))
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "Archive"
With Worksheets("Sheet1")
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 2 Step -1
If IsDate(.Cells(i, 1)) Then
If CLng(.Cells(i, 1).Value) < CLng(StartDate) Then
.Rows(i).Copy Destination:=Worksheets("Archive").Cells(Rows.Count, 1).End(xlUp).Offset(1)
.Rows(i).Cells.Clear
End If
End If
Next i
End With
Call Tester2a
End Sub
Bookmarks