+ Reply to Thread
Results 1 to 2 of 2

Dates as input to autofilter?

  1. #1
    Tobias
    Guest

    Dates as input to autofilter?

    Hello,

    I have a problem with filtering certain date due to dates that the user is
    supposed to give in two cells.
    Below are excerpt from the code;

    Dim FromDate As String
    Dim EndDate As String
    FromDate = Format(Worksheets("Sheet2").Range("H2").Value, "yyyy-mm-dd")
    EndDate = Format(Worksheets("Sheet2").Range("H3").Value, "yyyy-mm-dd")
    (...)
    MsgBox (FromDate)
    Selection.AutoFilter Field:=8, Criteria1:=">FromDate", Operator:=xlAnd _
    , Criteria2:="<EndDate"

    It works fine until the critera are supposed to be set. Then nothing
    happends. the result from the filtering is nothing (and there are data
    between the towo dates)

    Thanks,
    Tobias

  2. #2
    Tobias
    Guest

    RE: Dates as input to autofilter?

    Ok, I managed to solve it myself...

    "Tobias" skrev:

    > Hello,
    >
    > I have a problem with filtering certain date due to dates that the user is
    > supposed to give in two cells.
    > Below are excerpt from the code;
    >
    > Dim FromDate As String
    > Dim EndDate As String
    > FromDate = Format(Worksheets("Sheet2").Range("H2").Value, "yyyy-mm-dd")
    > EndDate = Format(Worksheets("Sheet2").Range("H3").Value, "yyyy-mm-dd")
    > (...)
    > MsgBox (FromDate)
    > Selection.AutoFilter Field:=8, Criteria1:=">FromDate", Operator:=xlAnd _
    > , Criteria2:="<EndDate"
    >
    > It works fine until the critera are supposed to be set. Then nothing
    > happends. the result from the filtering is nothing (and there are data
    > between the towo dates)
    >
    > Thanks,
    > Tobias


+ 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