ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Filer dates (https://www.excelbanter.com/excel-discussion-misc-queries/120135-filer-dates.html)

Steen

Filer dates
 
Hi

When I use the below code for the autofilter conditions - txtStartDate and
txtEndDate dosn't work. The dates are in the custom filter if I look after
running the code and if I reactivate it after this everything i ok. Any help?

txtStartDate and txtEndDate are input via text fields in a userform.

Private Sub cmdOK_Click()

if (Err)
...
Else
Selection.AutoFilter Field:=3, Criteria1:="=" & txtStartDate.Value,
Operator:=xlAnd, Criteria2:="<=" & txtEndDate.Value
End If
...
End Sub


Ron de Bruin

Filer dates
 
In which format are the dates in the worksheet cells ?

You can also use EasyFilter to filter on Dates
Maybe you like it
http://www.rondebruin.nl/easyfilter.htm



"Steen" wrote in message ...
Hi

When I use the below code for the autofilter conditions - txtStartDate and
txtEndDate dosn't work. The dates are in the custom filter if I look after
running the code and if I reactivate it after this everything i ok. Any help?

txtStartDate and txtEndDate are input via text fields in a userform.

Private Sub cmdOK_Click()

if (Err)
...
Else
Selection.AutoFilter Field:=3, Criteria1:="=" & txtStartDate.Value,
Operator:=xlAnd, Criteria2:="<=" & txtEndDate.Value
End If
...
End Sub


Steen

Filer dates
 
Hi Ron

The cells in the worksheet are in the following format "yyyy.mm.dd"

"Ron de Bruin" wrote:

In which format are the dates in the worksheet cells ?

You can also use EasyFilter to filter on Dates
Maybe you like it
http://www.rondebruin.nl/easyfilter.htm



"Steen" wrote in message ...
Hi

When I use the below code for the autofilter conditions - txtStartDate and
txtEndDate dosn't work. The dates are in the custom filter if I look after
running the code and if I reactivate it after this everything i ok. Any help?

txtStartDate and txtEndDate are input via text fields in a userform.

Private Sub cmdOK_Click()

if (Err)
...
Else
Selection.AutoFilter Field:=3, Criteria1:="=" & txtStartDate.Value,
Operator:=xlAnd, Criteria2:="<=" & txtEndDate.Value
End If
...
End Sub




All times are GMT +1. The time now is 01:16 PM.

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