Deleteing date over 1 year old

W

Wolfwalker721

I have a few columns of dates with coresponding numbers in the next column. I
am trying to delete the dates older then one year from Today() and the
coresponding number in the next column. These dates are in order so when it
runs out of dates OR the date is less then one year I would like it to go
over 5 colums and do it again until it runs out of data.

I know most people post the code they are trying to use but in this case I
am looking for a completely fresh perspective.

Any help would be appriciated =)

Thanks!
 
W

Wolfwalker721

THANKS!!

Simon Lloyd said:
This should do what you want:

Code:
--------------------
Sub remove_old_dates()
Dim Rng As Range, Mycell As Range
Dim i As Long, ic As Long 'MsgBox ActiveSheet.UsedRange.Columns.Count
Set Rng = ActiveSheet.UsedRange
For ic = 1 To ActiveSheet.UsedRange.Columns.Count Step 5
For i = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
If Cells(i, ic).Value < Date - 365 Then
Cells(i, ic).EntireRow.Delete
End If
Next i
Next ic
End Sub
--------------------






--
Simon Lloyd

Regards,
Simon Lloyd
'Microsoft Office Help' (http://www.thecodecage.com)
 

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

Top