+ Reply to Thread
Results 1 to 5 of 5

Automatically delete rows after time period using time stamp (have partial code)

  1. #1
    Registered User
    Join Date
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    365
    Posts
    2

    Automatically delete rows after time period using time stamp (have partial code)

    Cross-posted at https://www.mrexcel.com/board/thread...-code.1219627/ --6SJ

    I am looking to apply a timestamp, and automatically delete the row when it is 4 years old. I can make it work to automatically delete the row within a 24 time period, but I cannot set larger periods or I am presented with a type mismatch.
    This is the code I was using
    Please Login or Register  to view this content.
    I identified the issue was quantifying it as time value so attempted to change it to the following:
    If Now > stampcell.Value2 + DateAdd("d", 1, stampcell.Value2) Then

    This was so I could test it before changing it to 6 years.

    Is there anyway for me to do this?
    Last edited by 6StringJazzer; 10-18-2022 at 03:17 PM. Reason: added xpost link

  2. #2
    Forum Contributor
    Join Date
    10-08-2018
    Location
    Lima, Peru
    MS-Off Ver
    Office 365 ProPlus
    Posts
    148

    Re: Automatically delete rows after time period using time stamp (have partial code)

    Hi there,

    This will check for 4 years:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Leo Skywalker
    May the force be with you.

  3. #3
    Registered User
    Join Date
    10-18-2022
    Location
    Scotland
    MS-Off Ver
    365
    Posts
    2

    Re: Automatically delete rows after time period using time stamp (have partial code)

    Thank you so much! Was about tearing my hair out and ignored the simple solution.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Automatically delete rows after time period using time stamp (have partial code)

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not told us about this. You are required to do so.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important: https://excelguru.ca/a-message-to-forum-cross-posters/

    You now have people duplicating effort by providing answers in both places. That is why we (and also the other forum) require you to provide a link if you ask the same question in other places.

    I have added the link to your post since it's your first thread.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  5. #5
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Automatically delete rows after time period using time stamp (have partial code)

    Quote Originally Posted by LeoSkywalker View Post
    This will check for 4 years:
    Take leap year into account:

    Please Login or Register  to view this content.

+ 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. Time stamp delete unwanted rows
    By danny072 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-27-2021, 02:15 PM
  2. Delete rows after a certain time period has passed
    By JRC1 in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 03-02-2017, 05:57 AM
  3. Copy all rows w/ time stamp after certain time
    By athyeh in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-06-2015, 12:47 PM
  4. [SOLVED] Stamp Date and Time automatically
    By Teblol in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-20-2015, 02:02 PM
  5. Replies: 8
    Last Post: 06-20-2014, 02:40 AM
  6. [SOLVED] I want to automatically update cell comments with time stamp last time cell changed
    By Med_MV in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2013, 02:35 AM
  7. Replies: 3
    Last Post: 11-06-2012, 01:37 AM

Tags for this Thread

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