ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Filter set in macro filters all values out (https://www.excelbanter.com/excel-programming/422089-filter-set-macro-filters-all-values-out.html)

PVD Wales

Filter set in macro filters all values out
 
The following small macro results in no rows showing in the auto filtered
table. If I open the custom the filter dialog then click on OK the expected
rows are shown. I am using excel 2003.
Any ideas?

Sub Due14()
'

' filter for next status change due in next 14 days
'
B4next$ = "<" + Format(Now() + 14, "short date")
Selection.AutoFilter Field:=17, Criteria1:=B4next$

End Sub


joel

Filter set in macro filters all values out
 
the criteria need to be a serial date try this change. You don't need a
string date.


Sub Due14()
'

' filter for next status change due in next 14 days
'
B4next$ = "<" & (Now() + 14)
Selection.AutoFilter Field:=17, Criteria1:=B4next$

End Sub

"PVD Wales" wrote:

The following small macro results in no rows showing in the auto filtered
table. If I open the custom the filter dialog then click on OK the expected
rows are shown. I am using excel 2003.
Any ideas?

Sub Due14()
'

' filter for next status change due in next 14 days
'
B4next$ = "<" + Format(Now() + 14, "short date")
Selection.AutoFilter Field:=17, Criteria1:=B4next$

End Sub



All times are GMT +1. The time now is 10:19 PM.

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