View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tobias Tobias is offline
external usenet poster
 
Posts: 12
Default 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