For dates you need to convert the argument into a number.
Andreas.
Sub Test()
Range("A1").CurrentRegion.AutoFilter 4, "<" & CLng(Date - 14)
End Sub
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello experts,
I have a dataset in which I have a date column which i want to filter and the basis of that filter is "is before or equal to for today i.e. in vba date -14" and this filter is not working properly. I also try to store this value in a variable and then i tried to use it filter but nothing works.
I am pasting a screenshot for my code
And when i run this code the result is blank
Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.
For dates you need to convert the argument into a number.
Andreas.
Sub Test()
Range("A1").CurrentRegion.AutoFilter 4, "<" & CLng(Date - 14)
End Sub
Thanks for the help it resolved now