View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Variables into autofilters

Hi Zippy

input by the user such as a Start_date and an End_date?


Tip from this page
http://www.rondebruin.nl/copy5.htm

Or use two cells on your worksheet with the dates
rng.AutoFilter Field:=4, Criteria1:="=" & CLng(Range("B1").Value), _
Operator:=xlAnd, Criteria2:="<=" & CLng(Range("C1").Value)


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Zippy" wrote in message ...
I know I can input an autofilter such as:

AutoFilterMode = False
.Range("A1:D1").AutoFilter
.Range("A1:D1").AutoFilter Field:=2, Criteria1:="=35", _
Operator:=xlAnd, Criteria2:="<=45"

But how do I get the two criteria to be read from variables whose values are
input by the user such as a Start_date and an End_date?

TIA.

Zippy.