Dates as input to autofilter?

G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top