+ Reply to Thread
Results 1 to 4 of 4

Macro that deletes rows that are blank in a column H and last Fridays thru Current Date

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

    Macro that deletes rows that are blank in a column H and last Fridays thru Current Date

    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 is blank AND the date in column C is the previous Friday thru Current date (6/30,7/1,7/3,7/4) .

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

    Thank you so much in advance
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Macro that deletes rows that are blank in a column H and last Fridays thru Current Dat

    Hi there,

    Try the attached file.

    The macro is working form the current day's date. So you can run it on Monday or Tuesday...
    Hence in order to test for last weeks', replace 'Date' with 45110 (this represents July 3rd in excel).

    Please Login or Register  to view this content.
    Attached Files Attached Files
    If your Question is answered; please mark it SOLVED. If you are happy with a member's solution, say 'Thanks' and click the 'Star' to Add Reputation.

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

    Re: Macro that deletes rows that are blank in a column H and last Fridays thru Current Dat

    I am getting a run time error 1004: " This can not be applied to the selected range. Select a single cell in a range and try again."
    Debugger highlighted line 23- .AutoFilter field:=8, Criteria1:=""

    I don't have any lines that would be deleted this week anyways with these macro but I would to get this figured out so i can call on it in another macro

  4. #4
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Macro that deletes rows that are blank in a column H and last Fridays thru Current Dat

    I can't replicate the error you are getting. The code runs at my end even if there are no matching records to delete.

    The range of data to filter for must start in cell A1. If your data starts in another row or column, then we need to adjust the code.

    Maybe you can upload a 'sanitized' version without confidential data of the file causing the error.

+ 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. Macro That deletes rows based on date and text
    By toastmaster12 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-10-2023, 05:36 PM
  2. [SOLVED] Fill column with next Fridays date
    By Metrazal in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2014, 07:12 AM
  3. [SOLVED] Display Fridays date (and message) if current date is Monday
    By Pierce Quality in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2013, 09:40 AM
  4. [SOLVED] Macro to delete rows with zero in column deletes row that contain 0 in any number
    By Bjordion in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-26-2012, 02:55 AM
  5. Replies: 15
    Last Post: 02-06-2011, 06:13 AM
  6. Writing a macro that deletes blank rows
    By britt@wjg in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-11-2008, 02:33 PM
  7. blank rows:program that deletes blank rows
    By phil2006 in forum Excel General
    Replies: 2
    Last Post: 06-19-2006, 11:10 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