I want to activate an existing autofilter to sort between two dates. The dates are stored in two cells (lets call them A1 and A2 for this example). I've tried several syntax versions but nothing seems to work. Please help.
I want to activate an existing autofilter to sort between two dates. The dates are stored in two cells (lets call them A1 and A2 for this example). I've tried several syntax versions but nothing seems to work. Please help.
"The amount of stupid people in the world is God's way of punishing the smart people" - protean_being
Dates are problemmatical in VBA. The best way that I have foudn is to use the numberformat of the first cell in the range being filtered, like this
rng.Autofilter Field:=1,Criteria1:= Format(Date, rng.Cells(2,1).Numberformat)
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
thx
"The amount of stupid people in the world is God's way of punishing the smart people" - protean_being