ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter macro issues (https://www.excelbanter.com/excel-programming/389587-autofilter-macro-issues.html)

fgwiii[_2_]

Autofilter macro issues
 
Earlier this morning, I received code similar to this:

With ActiveSheet.UsedRange
.AutoFilter
.AutoFilter _
Field:=10, _
Criteria1:=Format(Date - 1, "mm/dd/yyyy 0:00")
End With

End Sub

The issue is that while this does appear make the correct selection in the
autofilter, the sheet comes up blank. If I manually click on the same
selection, then the data in the sheet is displayed.

Any thoughts?

Thanks,

Fred

Ben

Autofilter macro issues
 
Hi Fred,

I struggled with the same error. An alternatives that worked to solve my
problem is use Clng on your date as follows:
Criteria1:=CLng(Format(Date - 1, "mm/dd/yyyy 0:00"))
Otherwise try function Dateserial.

Good luck

Ben

"fgwiii" wrote:

Earlier this morning, I received code similar to this:

With ActiveSheet.UsedRange
.AutoFilter
.AutoFilter _
Field:=10, _
Criteria1:=Format(Date - 1, "mm/dd/yyyy 0:00")
End With

End Sub

The issue is that while this does appear make the correct selection in the
autofilter, the sheet comes up blank. If I manually click on the same
selection, then the data in the sheet is displayed.

Any thoughts?

Thanks,

Fred



All times are GMT +1. The time now is 07:35 AM.

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