Hi so I have run into an unexpected problem.
with this code
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 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
Next i
End With
Call Tester2a
End Sub
It gives a type error when I have the word "1 target" on column A more than once. I have the word "1 target" about 1000 times down column A and then the date begins on column A. So I want the code to ignore the word "1 target". I put it into the if statement and said
If CLng(.Cells(i, 1).Value) < CLng(StartDate) And CLng(.Cells(i, 1).Value)<> "1 target" Then
but it gave me an error.
Any help please?
Bookmarks