#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 27
Default Filter date in macro

Hi,

i set up a macro below to filter out a column (dates) that are more than
cell F2, where cell F2 is also a date. But it just doesn't work. Why? Thanks!

Sub Filter_BS()

Selection.AutoFilter Field:=7, Criteria1:="" & Range("f2"),
Operator:=xlAnd

End Sub

Val
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Filter date in macro

I'd try:

Selection.AutoFilter Field:=7, _
Criteria1:="" & format(Range("f2").value,"mm/dd/yyyy")

But match the numberformat of the dates in that field.

Dolphinv4 wrote:

Hi,

i set up a macro below to filter out a column (dates) that are more than
cell F2, where cell F2 is also a date. But it just doesn't work. Why? Thanks!

Sub Filter_BS()

Selection.AutoFilter Field:=7, Criteria1:="" & Range("f2"),
Operator:=xlAnd

End Sub

Val


--

Dave Peterson
Reply
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
Filter macro doesn't like link dzelnio Excel Discussion (Misc queries) 0 June 14th 07 08:08 PM
Dupliate names with different date Filter for newest date Becky Excel Discussion (Misc queries) 1 April 8th 07 09:38 PM
how can this filter be done in a macro? Dave F Excel Discussion (Misc queries) 8 March 2nd 07 10:22 AM
Do i use a filter or a macro? Anthony Excel Discussion (Misc queries) 2 January 10th 07 12:11 PM
Need a filter macro comotoman Excel Discussion (Misc queries) 0 October 6th 05 10:03 PM


All times are GMT +1. The time now is 12:50 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"