Auto Filter and Criteria1 variable
Thanks again Tom. Just what I needed, worked for me too.
D.S.
"Tom Ogilvy" wrote in message ...
This worked for me:
Sub AAA2()
Dim dteFilterDate As Date
dteFilterDate = CDate(InputBox("Enter date"))
Range("AK2").CurrentRegion.Select
Selection.AutoFilter Field:=18, Criteria1:="<= " & CLng(dteFilterDate)
End Sub
--
Regards,
Tom Ogilvy
D.S. wrote in message
...
I'm trying to code a worksheet filter by using a variable as < Criteria1 .
The variable < dteFilterDate will be set by an InputBox, and has been
dimensioned as a DATE. The following line of code gives me a run time
error #1004, AutoFilter method of Range class failed
Selection.AutoFilter Field:=18, Criteria1:="<= " & dteFilterDate
I've probably got a syntax problem, but haven't found the right combination
of characters.
Any ideas?
D.S.
|