Filter date in macro

G

Guest

Hi,

i set up a macro below to filter out a column (dates) that are more than
cell F2, where cell F2 is also a date. But it just doesn't work. Why? Thanks!

Sub Filter_BS()

Selection.AutoFilter Field:=7, Criteria1:=">" & Range("f2"),
Operator:=xlAnd

End Sub

Val
 
D

Dave Peterson

I'd try:

Selection.AutoFilter Field:=7, _
Criteria1:=">" & format(Range("f2").value,"mm/dd/yyyy")

But match the numberformat of the dates in that field.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top