ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Automatic cell content deletion (https://www.excelbanter.com/excel-discussion-misc-queries/106806-automatic-cell-content-deletion.html)

[email protected]

Automatic cell content deletion
 
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.


Naveen

Automatic cell content deletion
 
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 ***




" wrote:

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.



[email protected]

Automatic cell content deletion
 

Naveen wrote:
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








" wrote:

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.




[email protected]

Automatic cell content deletion
 

Naveen wrote:
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)






" wrote:

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.




Naveen

Automatic cell content deletion
 
- 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 ***

" wrote:

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.




All times are GMT +1. The time now is 04:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com