Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The problem may be your regional settings. Try formatting the date as a
number: '================================== Selection.AutoFilter Field:=3, Criteria1:="=" & Str(CDbl(Range("K1").Value)), _ Operator:=xlAnd, Criteria2:="<=" & Str(CDbl(Range("L1").Value)) '================================== Ron McCormick wrote: Thanks Debra & Paul, Both responses have been helpful, but I have one further problem. Whenever I run the macro the whole of the list is hidden. If I then go to Data/Autofilter/Custom and click OK the filtered list appears. Why does it not appear automatically? -----Original Message----- Another option is to create dropdown lists of the dates on the worksheet using data validation: http://www.contextures.com/xlDataVal01.html Create a dropdown for start date, and one for end date, then format these dates the same as the dates in column C. The user selects a start and end date from the dropdown lists, then runs the AutoFilter macro: '================================== Selection.AutoFilter Field:=3, Criteria1:="=" & Range ("K1").Value, _ Operator:=xlAnd, Criteria2:="<=" & Range("L1").Value '================================== Ron McCormick wrote: I would like to write a procedure that would allow a user to enter dates ie one greater than and the other less than in a programmed autofilter procedure. Essentially I would want the user to be able to insert their own chosen dates in place of the dates that appear in the undernoted code without them seeing the code. Selection.AutoFilter Field:=3, Criteria1:="31/10/2002", Operator:=xlAnd, Criteria2:="<=31/10/2003" -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel vba autofilter code | Excel Discussion (Misc queries) | |||
Excel VBA AutoFilter code | Excel Discussion (Misc queries) | |||
vba code on autofilter | Excel Discussion (Misc queries) | |||
Autofilter code | Excel Discussion (Misc queries) | |||
Using autofilter, how do I enter several random postcodesinto 'co. | Excel Discussion (Misc queries) |