Automatic cell content deletion

G

groaner

In the example below:

Is it possible for the contents of cells A1-B1-C1 and D1 to
automatically clear (without deleting the row) when the date in A1 is
more than 60 days old? - and - have the contents in the next cells
down, move up to the top.


In other words, this is a Pass Log and entries over 60 days old are no
longer needed.


A1, B1, C1 and D1 in the following ,will no longer be an issue in
October so those cells would clear in October and the entries currently

in A2, B2, C2 and D2 would move up one row and remain there till they
were 60 days old..... and so forth down the sheet.


A B C D
1 8/31/06 5776 Jones Smith
2 9/22/06 5778 Brown Wallace


Thanks
Johnnie

P.S. - yep, this is that same old sheet with the print button that I
bothered everybody with.
 
G

Guest

Try this procedure ...

======================================
Sub Naveen()
If DateDiff("d", Date, Range("A1")) Then
Range("A1:D1").Delete Shift:=xlUp
Else
MsgBox "Everything OK! Bye!"
End If

End Sub
======================================



*** Please do rate ***
 
G

groaner

Naveen said:
Try this procedure ...

======================================
Sub Naveen()
If DateDiff("d", Date, Range("A1")) Then
Range("A1:D1").Delete Shift:=xlUp
Else
MsgBox "Everything OK! Bye!"
End If

End Sub
======================================



Actually, I don't know exactly how to do that or where to put it. But,
wouldn't it have to have a reference as to when to clear the cell?

Thanks
Johnnie
 
G

groaner

Naveen said:
Try this procedure ...

======================================
Sub Naveen()
If DateDiff("d", Date, Range("A1")) Then
Range("A1:D1").Delete Shift:=xlUp
Else
MsgBox "Everything OK! Bye!"
End If

End Sub
======================================

Actually, I don't know exactly how to do that or where to put it.
Little to no knowledge of VB.

Thanks
Johnnie (newbie)
 
G

Guest

- Click on "Tools" menu
- Click on "Macro" sub-menu
- Click on "Visual Basic Editor" menu item
(or you can just press ALT-F11)
- On the "project explorer window" in "Visual Basic Editor" find your excel
file and right click on it.
- Select insert "Modules"
- Now paste my procedure.
- Come back to Excel
- Again goto "Tools->Macro->Macros"
- Select procedure name and click run

Bye

*** please do rate ***
 

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