+ Reply to Thread
Results 1 to 7 of 7

Macro to automate filter >= "inject todays date here"

  1. #1
    Registered User
    Join Date
    02-10-2005
    Posts
    4

    Thumbs up Macro to automate filter >= "inject todays date here" - >>Success<<

    Hi Excel gurus

    Help to automate the following would be greatly appreciated.

    I'm against a wall trying to create a Macro to automate a 'filter by >= "inject todays date here"

    I have a workbook with a column of past - present and future dates

    I's like to automate a sort feature via Macro to filter the display to today and future dates only (without drop down and manually selecting greater than or equal to then selecting todays date from list).

    Can I inject todays date from system time straight into a macro as a filter criteria - if yes - How?

    Thanks
    Last edited by carlstev; 03-16-2007 at 09:11 AM. Reason: RFH successful

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    How about

    >= TODAY()
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    02-10-2005
    Posts
    4
    like this?

    Selection.AutoFilter Field:=10, Criteria1:>=TODAY(), Operator:=xlAnd

  4. #4
    Registered User
    Join Date
    02-10-2005
    Posts
    4
    Present Macro looks like this;

    Sub TAB_report()
    '
    ' TAB_report Macro
    ' Macro recorded 3/14/2007 by Xxxx
    '
    ' Keyboard Shortcut: Ctrl+q
    '
    Range("A1:K408").Sort Key1:=Range("J2"), Order1:=xlAscending, Header:= _
    xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, _
    DataOption1:=xlSortNormal
    Range("A1:S1").Select
    Selection.AutoFilter
    Cells.Select
    Cells.EntireColumn.AutoFit
    Columns("C:C").Select
    ActiveWindow.SmallScroll Down:=-6
    Selection.ColumnWidth = 14.86
    Columns("D:D").Select
    Selection.ColumnWidth = 48.43
    Range("C2").Select
    ActiveWindow.FreezePanes = True
    Selection.AutoFilter Field:=8, Criteria1:="=TAB Review", Operator:=xlAnd
    ActiveWindow.SmallScroll Down:=-9
    Selection.AutoFilter Field:=10, Criteria1:=">=TODAY()", Operator:=xlAnd
    End Sub

    Clearly doesn't work for the following reasons that I can determine;
    >=TODAY() is recorded as a string literal - which it isn't, its a system date injected - I'm lacking the knowledge, skill and or resources to define the correct mode of 'injection' for todays date.

    All direction is appreciated

  5. #5
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Try following ...
    Please Login or Register  to view this content.
    HTH
    Carim


    Top Excel Links

  6. #6
    Registered User
    Join Date
    02-10-2005
    Posts
    4

    Thumbs up Success - thanks Carim

    Thank you Carim -

    exactly what I required, simple when you know what/how.

    Best regards

    Carl

  7. #7
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    You are welcome ...

    Thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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