Deleting entries one year old

A

AOP

I have the following code which deletes all entries that are one year old to
date.

Private Sub deleteit()
Dim LastRow As Long
Dim X
LastRow = Range("A20000").End(xlUp).Row

For X = LastRow To 1 Step -1
If Cells(X, 1).Value < Date - 365 Then
Range("A" & X & ":p" & X).ClearContents
End If
Next
End Sub

This code works well, but what I need is only to clear columns A to F and H.
I need it to leave column G alone because it has formulas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Match style 0
Code to delete rows based on value 11
Extract Text in braquet and list of terms from 2 Docs 3
deleting workbooks as i go 4
R1C1 1
automatic page break 1
R1C1 0
HELP Copy And Paste 7

Top