+ Reply to Thread
Results 1 to 8 of 8

Delete Rows if Date in Column A is Older Than 6 Years

  1. #1
    Registered User
    Join Date
    10-30-2014
    Location
    Mechanicsville, VA
    MS-Off Ver
    2007
    Posts
    5

    Delete Rows if Date in Column A is Older Than 6 Years

    I've been Frankenstein'ing code together to try to delete rows based on the date in column A. If the date is older than 6 years from today then that row needs to be deleted. This is what I've come up with. It runs, but it deletes the entire spreadsheet, haha.

    Please Login or Register  to view this content.

  2. #2
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    Try this.... Assuming your dates in Column A

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    10-30-2014
    Location
    Mechanicsville, VA
    MS-Off Ver
    2007
    Posts
    5

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    Thank you for the reply. I just can't get anything to work. It really shouldn't be this difficult. :P

  4. #4
    Registered User
    Join Date
    09-29-2014
    Location
    KC
    MS-Off Ver
    2007
    Posts
    20

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    Not an expert myself, but wouldn't it be faster to sort and filter the records by date, then delete the visible rows instead of looping through each record?

    Just a thought.

    Bill

  5. #5
    Registered User
    Join Date
    10-30-2014
    Location
    Mechanicsville, VA
    MS-Off Ver
    2007
    Posts
    5

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    It's a good idea, and I've tried most everything short of getting a macro going. The list is just too big. Thousands and thousands of records to scroll through.

  6. #6
    Registered User
    Join Date
    09-29-2014
    Location
    KC
    MS-Off Ver
    2007
    Posts
    20

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    BantamPCI, here is something that I use. I gathered some code from various places plus figured some out on my own. There are three proc's here. One for turning the Autofilter on and off, one for sorting by date and the other for deleting selected records. Mine uses a date range entered by the user as opposed to being set to look back wards 6 years, but I believe that there is some good you might be able to gather from it. You'll need to make sheet name and probably some other changes. Hope it helps.

    Bill

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    09-05-2012
    Location
    Dubai
    MS-Off Ver
    Office 365
    Posts
    409

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    It is as simple as it is...... try this........ attachment.....
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-29-2014
    Location
    KC
    MS-Off Ver
    2007
    Posts
    20

    Re: Delete Rows if Date in Column A is Older Than 6 Years

    Great!. Always looking for something simpler and to learn from. Thanks.

    Bill

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] If date older than 2 years, insert Reuse in formula cell
    By hayestrent in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 11-04-2014, 02:44 PM
  2. [SOLVED] Using Countif and Subtotal based on date older than 2 years ago
    By simmy981 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-10-2014, 04:29 AM
  3. [SOLVED] Date older than 3 years? (yes/no)
    By wintheranders in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-19-2013, 06:00 AM
  4. [SOLVED] Conditional Formatting. Anything 4.5 years old + older from todays date needs Highlight.
    By themanwithnoshoes in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-25-2012, 11:58 AM
  5. Delete lines with older date
    By VDREECK in forum Excel General
    Replies: 2
    Last Post: 01-14-2011, 03:51 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1