Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Auto delete a row after 5 weeks in Excel

I want to set up a prayer list for the Church. I will use rows for names,
and illnesses then put a date when it was posted. I think I need a formula
to make that row delete after 5 weeks. How do I make a row on an Excel
spreadsheet completely delete after a set time frame?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Auto delete a row after 5 weeks in Excel

Hi,
If your dates are in Column C, and your data starts in row 2, try this small
macro:

Sub DeleteOld()
A = 0
Do Until Range("C2").Offset(A, 0) = ""
If Range("C2").Offset(A, 0) < Date - 35 _
Then Range("C2").Offset(A, 0).EntireRow.ClearContents
A = A + 1
Loop
End Sub

If your dates start in some other cell, change the 3 instances of C3 to the
first date cell reference.

Right click the sheet tab, select View Code, paste the above into the VBA
window.
You can use a button to fire the macro, which will delete each entry that's
passed its use-by date.

If you want this to happen automatically, you'll need to change the code
slightly and put it somewhere else. Let me know.

Note: This deletes the whole row, which makes it simple to write code, but
undesirable if you have other info in columns to the right.

Regards - Dave.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Auto delete gane Excel Worksheet Functions 0 November 27th 07 08:14 AM
Auto delete..... gane New Users to Excel 2 November 21st 07 05:58 AM
Is it possible in Excel to have a file auto delete on a given dat. Van Excel Worksheet Functions 6 October 9th 07 09:50 PM
how to delete an auto footer Dool Excel Discussion (Misc queries) 4 June 10th 05 01:19 PM
calculate weeks from a start date ( not yr weeks) Todd F. Excel Worksheet Functions 6 November 27th 04 05:53 PM


All times are GMT +1. The time now is 07:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"