+ Reply to Thread
Results 1 to 5 of 5

dynamic date range filter from cell value in vba

  1. #1
    Registered User
    Join Date
    07-25-2011
    Location
    Novato, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    dynamic date range filter from cell value in vba

    I have a work book linked to an external data source, and would like to sort the data using dynamic date ranges from a drop down list in a cell.

    I've tried everything I can think of to make the code work.

    Currently I have a drop-down list in cell C13 and a vlookup formula that returns xlFilterYesterday

    Here is the code that doesn't work

    PHP Code: 
    ActiveSheet.ListObjects("Table_SalesLineItems11").Range_
            AutoFilter Field
    :=1Criteria1:=Range("C12"), Operator:=xlFilterDynamic 
    Here is the original code I have where I have several button on the worksheet making things complicated.

    PHP Code: 
    ActiveSheet.ListObjects("Table_SalesLineItems11").Range_
            AutoFilter Field
    :=1Criteria1:=xlFilterYesterdayOperator:=xlFilterDynamic 
    I also hoping this will cut down the amount of code I have in the Module significantly.

    Any help would be greatly appreciated.

    Thanks,

    Rusty

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: dynamic date range filter from cell value in vba

    Use the value, 2.

  3. #3
    Registered User
    Join Date
    07-25-2011
    Location
    Novato, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: dynamic date range filter from cell value in vba

    Thank you for your reply...

    Could you please elaborate a little more? I must be missing something.

    Thanks,

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: dynamic date range filter from cell value in vba

    Please Login or Register  to view this content.
    Or if cell A2 on the activesheet has your value of 2:
    Please Login or Register  to view this content.
    You can also pass the value in a parameter:
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 07-25-2011 at 05:07 PM.

  5. #5
    Registered User
    Join Date
    07-25-2011
    Location
    Novato, CA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: dynamic date range filter from cell value in vba

    Thanks I appreciate the help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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