ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dates as input to autofilter? (https://www.excelbanter.com/excel-programming/323915-dates-input-autofilter.html)

Tobias

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

Tobias

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



All times are GMT +1. The time now is 05:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com