Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm having some trouble using vba to to autofilter some data based on the
date in column A of worksheet named Test The filter appears to work if I do it manually Column A is formatted as a date (dd/mm/yyyy) Would one (or more ) of you gurus please assist by pointing out the error(s) in the code below Windows XP Pro MS Excel 2003 Regards and TIA Jim Burton ----------------------- Dim StartDate As Date Dim EndDate As Date StartDate = Format(InputBox("Enter Start date for the report" ), "dd/mm/yyyy") 'error traps removed for clarity EndDate = Format(InputBox("Enter End date for the report"), "dd/mm/yyyy") 'error traps removed for clarity With Sheets("Test)") If AutoFilterMode = True Then .AutoFilterMode = False .Columns("A:G").Select With Selection Selection.AutoFilter Selection.AutoFilter Field:=1, Criteria1:="=" & StartDate, Operator:=xlAnd, Criteria2:="<=" & EndDate Selection.AutoFilter Field:=3, Criteria1:="<" Selection.AutoFilter Field:=7, Criteria1:="=" End With With Sheets("Test").PageSetup .PrintArea = "$A:$F" .CenterHeader = "&""Comic Sans MS,Bold Italic""&14Test Macro" End With ScreenUpdating = True Sheets("Test").PrintPreview ScreenUpdating = False .AutoFilterMode = False End With |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Using Autofilter to exclude dates | Excel Worksheet Functions | |||
Using dates with autofilter | Excel Programming | |||
Autofilter- show dates differently | Excel Discussion (Misc queries) | |||
Dates as input to autofilter? | Excel Programming | |||
Filtering out dates using autofilter | Excel Programming |