LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Help please with autofilter and dates

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Autofilter to exclude dates Ian Excel Worksheet Functions 11 August 1st 08 01:41 PM
Using dates with autofilter skuzapo Excel Programming 2 May 22nd 06 12:13 PM
Autofilter- show dates differently lunker55 Excel Discussion (Misc queries) 3 November 10th 05 06:58 PM
Dates as input to autofilter? Tobias Excel Programming 1 February 24th 05 10:53 AM
Filtering out dates using autofilter sk8rider[_3_] Excel Programming 2 June 16th 04 09:43 PM


All times are GMT +1. The time now is 03:12 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"