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
--------------------
Wolfwalker721;490100 Wrote:
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!
--
Simon Lloyd
Regards,
Simon Lloyd
'Microsoft Office Help' (
http://www.thecodecage.com)
------------------------------------------------------------------------
Simon Lloyd's Profile:
http://www.thecodecage.com/forumz/member.php?userid=1
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=135104