View Full Version : [SOLVED:] autofilter dates
ProteanBeing
12-20-2007, 10:40 AM
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.
Bob Phillips
12-20-2007, 10:48 AM
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)
ProteanBeing
12-20-2007, 11:36 AM
thx
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.