+ Reply to Thread
Results 1 to 2 of 2

macro to filter to a date 2 or 3 days ago

  1. #1
    Registered User
    Join Date
    05-12-2016
    Location
    Newcastle, England
    MS-Off Ver
    2010
    Posts
    10

    macro to filter to a date 2 or 3 days ago

    Hi i wonder if anyone can help, i have a macro i run to tell me what jobs were completed the day before. The code in the macro for that is simply:

    ActiveSheet.Range("$A$2:$BV$198081").AutoFilter Field:=11, Criteria1:= _
    xlFilterYesterday, Operator:=xlFilterDynamic

    however on a Monday, i need to know what work was completed on a Friday, Saturday and Sunday. Ideally i need to bring each day back separately but using the code above will only tell me what was done on a Sunday.

    I've tried using various combinations of yesterday - 1, Date -2 etc, but i just keep getting errors.

    If i change the code to specify an actual date it works, but would rather not have to adapt the macro every week. Is there a way i can have a macro to tell me Friday's work (ie date -3 if ran on a Monday) and Saturdays work (date - 2).

    Can anyone point me in the right direction please?

    Thanks

  2. #2
    Forum Expert
    Join Date
    02-11-2014
    Location
    New York
    MS-Off Ver
    Excel 365 (Windows)
    Posts
    5,945

    Re: macro to filter to a date 2 or 3 days ago

    You can use the between dates filter, with a variable starting date:

    Please Login or Register  to view this content.
    Bernie Deitrick
    Excel MVP 2000-2010

+ 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. VBA to filter from today's date + 4 business days
    By kop1ko in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-19-2016, 07:20 AM
  2. vba to filter table by today's date up to 10 days. and save as new version
    By The Fly in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-01-2014, 02:15 PM
  3. [SOLVED] Create a macro to filter between today and the next 30 days
    By jonathan.haynes in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 08-05-2013, 05:08 AM
  4. Working with Dates, VB MAcro to Auto Filter on last 7 days
    By Rikkdh in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 06-20-2013, 10:01 AM
  5. excel formula: days remaining=end date-todays date+extention days
    By fsprings in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 01-04-2013, 06:45 AM
  6. Pivot Filter Macro - Auto Update to select previous 30 days.
    By rocksolid77 in forum Excel General
    Replies: 2
    Last Post: 11-26-2012, 01:46 PM
  7. create a macro to alert me if today's date is within 5 days of expected delivery date
    By ashmcclure in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 09-25-2008, 05:51 PM

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