Displaying date in filter criteria
Hi All,
I am using the magnificent FilterCriteria tip as per http://j-walk.com/ss/excel/usertips/tip044.htm to display the filter criteria being used in AutoFilters. A question was asked on my blog about displaying the filter criteria as a date - if it is a date. http://robertmarkbramprogrammer.blog...omment-5150203 I.e. if I were to apply a custom filter: "is less than 15/01/2009", this is displayed: "<39828" Is there a way to change the macro code perhaps (or cell formatting) to make that "< 15/01/2009" instead? Thanks for any assistance! Rob :) |
Displaying date in filter criteria
Hello,
http://cjoint.com/?bshTcTRKcM http://boisgontierjacques.free.fr/pa...FiltreAuto.htm Function FiltreActuel(feuille, c As String, Optional typeCol As String) Application.Volatile n = Sheets(feuille).Range("_FilterDataBase").Columns.C ount col = Application.Match(c, Sheets(feuille).Range ("_FilterDataBase").Cells(1, 1).Resize(1, n), 0) If Sheets(feuille).FilterMode Then If Sheets(feuille).AutoFilter.Filters.Item(col).On Then temp = Sheets(feuille).AutoFilter.Filters.Item(col).Crite ria1 If Left(temp, 2) = "=" Or Left(temp, 2) = "<=" Then o = Left(temp, 2): n = Mid(temp, 3) Else If Left(temp, 1) = "=" Or Left(temp, 1) = "" Or Left(temp, 1) = "<" Then o = Left(temp, 1): n = Mid(temp, 2) Else n = temp End If End If If typeCol = "D" Then n = Format(n, "dd/mm/yy") temp = o & n '--- If Sheets(feuille).AutoFilter.Filters.Item(col).Opera tor Then oper = IIf(Sheets(feuille).AutoFilter.Filters.Item (col).Operator = 1, " ET ", " OU ") On Error Resume Next Err = 0 temp2 = Sheets(feuille).AutoFilter.Filters.Item (col).Criteria2 If Err = 0 Then If Left(temp2, 2) = "=" Or Left(temp2, 2) = "<=" Then o = Left(temp2, 2): n = Mid(temp2, 3) Else If Left(temp2, 1) = "=" Or Left(temp2, 1) = "" Or Left (temp2, 1) = "<" _ Then o = Left(temp2, 1): n = Mid(temp2, 2) End If If typeCol = "D" Then n = Format(n, "dd/mm/yy") temp2 = o & n Else oper = "" End If End If FiltreActuel = temp & oper & temp2 Else FiltreActuel = "" End If Else FiltreActuel = "" End If End Function JB http://boisgontierjacques.free.fr On 16 jan, 01:03, Robert Mark Bram wrote: Hi All, I am using the magnificent FilterCriteria tip as perhttp://j-walk.com/ss/excel/usertips/tip044.htm to display the filter criteria being used in AutoFilters. A question was asked on my blog about displaying the filter criteria as a date - if it is a date.http://robertmarkbramprogrammer.blog...cel-displaying... I.e. if I were to apply a custom filter: "is less than 15/01/2009", this is displayed: "<39828" Is there a way to change the macro code perhaps (or cell formatting) to make that "< 15/01/2009" instead? Thanks for any assistance! Rob :) |
Displaying date in filter criteria
A question was asked on my blog about displaying the filter criteria as a date - if it is a date.http://robertmarkbramprogrammer.blog...cel-displaying... I.e. if I were to apply a custom filter: "is less than 15/01/2009", this is displayed: "<39828" Is there a way to change the macro code perhaps (or cell formatting) to make that "< 15/01/2009" instead? http://cjoint.com/?bshTcTRKcMhttp://...FiltreAuto.htm Thank you JB! |
All times are GMT +1. The time now is 05:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com