+ Reply to Thread
Results 1 to 7 of 7

Macro That deletes rows based on date and text

  1. #1
    Registered User
    Join Date
    06-28-2023
    Location
    ney, york ,usa
    MS-Off Ver
    2013
    Posts
    6

    Macro That deletes rows based on date and text

    I'm slowly trying to automate a weekly report that I put together every Monday (sometimes Tuesday). The example I attached is from Monday 7/3 and hope to be able to use this macro on 7/10 or 7/11.

    I need a macro that will delete the row if the text in Column H starts with "auto" ("auto*" if was used in a formula) AND the date in column C is the previous Thursday thru Current date (6/29,6/30,7/1,7/3,7/4) .

    In this example, 8 rows should end up being deleted. This data is usually 15,000 ish rows long and the dates update every week.

    Thank you so much in advance
    Attached Files Attached Files

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Macro That deletes rows based on date and text

    Is this not the same as your previous thread?

  3. #3
    Registered User
    Join Date
    06-28-2023
    Location
    ney, york ,usa
    MS-Off Ver
    2013
    Posts
    6

    Re: Macro That deletes rows based on date and text

    No its a little different, previous thread was looking for any text in the cell and the date as criteria for deletion. That was a different part of the report as well

    This Thread I am looking for cell H to start with "auto" and the same date criteria for deletion. I could probably reuse the previous code to search for the date but I have no idea how to look for a specific starting text

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Macro That deletes rows based on date and text


    Quote Originally Posted by toastmaster12 View Post
    the date in column C is the previous Thursday
    thru Current date (6/29,6/30,7/1,7/3,7/4)
    So you want to not delete 6/28, 6/27, 6/20 and 6/1 ?

  5. #5
    Registered User
    Join Date
    06-28-2023
    Location
    ney, york ,usa
    MS-Off Ver
    2013
    Posts
    6
    Quote Originally Posted by Marc L View Post

    So you want to not delete 6/28, 6/27, 6/20 and 6/1 ?
    For for this example yes, the goal would have the previous Thursday -next Tuesday dates that meet the text criteria deleted. This example is from 7/3 so 6/28 and older should not be deleted

  6. #6
    Registered User
    Join Date
    07-10-2023
    Location
    Chicago, IL
    MS-Off Ver
    O365
    Posts
    4

    Re: Macro That deletes rows based on date and text

    Try this. Coded to be up to 25k rows. It is looking at value in column C. If it is today thru last thursday, AND column H has AUTO in it, it marks it as yes to be deleted and then it runs the next part of the macro and deletes all rows marked as yes.

    Please Login or Register  to view this content.
    Last edited by vidguru1979; 07-10-2023 at 05:28 PM.

  7. #7
    Registered User
    Join Date
    07-10-2023
    Location
    Chicago, IL
    MS-Off Ver
    O365
    Posts
    4

    Re: Macro That deletes rows based on date and text

    This should be dynamic now so if your data goes past 25k rows.

    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. [SOLVED] Help Edit Loop that deletes Rows based on Date condition.
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2015, 02:16 PM
  2. [SOLVED] Need Help cleaning up Macro that imports text file and deletes unnecessary rows
    By ppilot in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 07-16-2013, 10:44 PM
  3. Macro Deletes all rows except....
    By TheDriver85 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-25-2012, 06:37 PM
  4. Macro that deletes rows below a certain value
    By Biased Historian in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 01-15-2011, 09:45 PM
  5. Macro that Deletes All rows except first row
    By curtney in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-18-2006, 01:22 PM
  6. Macro that deletes certain rows only
    By supamari0 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-09-2006, 11:15 AM
  7. [SOLVED] Macro that deletes certain rows and not others
    By Roger in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 05-02-2005, 07:06 PM

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