ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Date format is not picked up correctly while filtering (https://www.excelbanter.com/excel-programming/383641-date-format-not-picked-up-correctly-while-filtering.html)

Vijay Kotian

Date format is not picked up correctly while filtering
 
In Excel Macros I have taken date format as DD-MMM-YY and assigned to a
variable and same picked up variable for filtering it is not possible to
filter?? Can anybody help me out ..... Please.........

Bob Phillips

Date format is not picked up correctly while filtering
 
Try this instead

Dim sDate As String

sDate = Format(Date,"dd-mmm-yy")
Selection.AutoFilter Field:=1, Criteria1:="<=" & sDate

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Vijay Kotian" wrote in message
...
In Excel Macros I have taken date format as DD-MMM-YY and assigned to a
variable and same picked up variable for filtering it is not possible to
filter?? Can anybody help me out ..... Please.........





All times are GMT +1. The time now is 03:58 AM.

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