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: 2
Default Why won't it work when I use VBA to set autofilter criteria to ce.

Below is an example of what I had programmed for a custom autofilter. The
cells in the criteria contain dates. When I run the Macro it hides all the
data. However if I then go into the custom filter manually the dates are
already entered in the criteria and I just have to press OK for the filter to
work. Is there a way around having to do this manually or can excel not
handle this sort of functionality?

Dim sStartDate As String
Dim sEndDate As String
Dim sBottomRow As String

sStartDate = Sheets("Data").Cells(6, 2).Value
sEndDate = Sheets("Data").Cells(6, 4).Value
sBottomRow = CStr(Sheets("Data").Range("B8").End(xlDown).Row)


Selection.AutoFilter Field:=8, Criteria1:="=" & sStartDate,
Operator:= _
xlAnd, Criteria2:="<=" & sEndDate
 
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
Autofilter doesn't work tombogman Excel Discussion (Misc queries) 7 January 18th 06 12:09 AM
Autofilter(Top 10...): What does it do? How does it work? Chet Hurd Excel Discussion (Misc queries) 3 May 10th 05 08:24 PM
AutoFilter Criteria VBA EstherJ Excel Programming 2 August 20th 04 12:54 PM
VBA Autofilter Criteria Brandon[_5_] Excel Programming 1 November 7th 03 12:40 PM
Help: Autofilter doesn't work Sebastian[_2_] Excel Programming 2 August 29th 03 04:37 PM


All times are GMT +1. The time now is 02:16 AM.

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

About Us

"It's about Microsoft Excel"