ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Custom Filter w/ formula (https://www.excelbanter.com/excel-discussion-misc-queries/210914-custom-filter-w-formula.html)

LH

Custom Filter w/ formula
 
How can I use a formula in a custom filter? I have a macro that formats and
sorts a report that I receive each day, but I want it to sort out everything
greater than today. I have tried to use the function =NOW(), but with no
success.

Sheeloo[_3_]

Custom Filter w/ formula
 
Adapt the idea in the following macro to your macro;

Sub Macro1()
Dim dt As String
'Build the criteria
dt = "" & CStr(Date)
Columns("A:C").Select
Selection.AutoFilter
'Filter the range A1:C29 on Col C using the criteria built above

ActiveSheet.Range("$A$1:$C$29").AutoFilter Field:=3, _
Criteria1:= dt
End Sub

"LH" wrote:

How can I use a formula in a custom filter? I have a macro that formats and
sorts a report that I receive each day, but I want it to sort out everything
greater than today. I have tried to use the function =NOW(), but with no
success.



All times are GMT +1. The time now is 08:17 PM.

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