G
Guest
What is the code for deleting data that is 1 year old ( a rolling year).
Dates are on column A and data runs from columns B to P.
Dates are on column A and data runs from columns B to P.
Geo said:Thanks Dave but I still get the same error message but this time it
highlights 'x' in the code?
Has that got to change as well?
Sorry Chip I get the following error message:
RunTime error 1004
Application-defined or object-defined error
Iv got the code as follows:
Sub deleteit()
Dim X
Dim LastRow As Long
LastRow = Range("A60000").End(xlUp).Row
For X = LastRow To 1 Step -1
If Cells(X, 1).Value < Date - 365 Then
Range("A" & X & ":H" & X).ClearContents
End If
Next
End Sub
Hi Dave,
Initialy it was: For X
on advise I added: Dim X to the code
still got error message.
Hi Dave,
Initialy it was: For X
on advise I added: Dim X to the code
still got error message.
Its Dim X gives me the error
But if I romove "Dim X"
the error high lights X of the For X part of the code.
--
Geo
Dave Peterson said:ps. The code worked ok for me.