PC Review


Reply
Thread Tools Rate Thread

Autofiltering by Date Range entered by User

 
 
exwrexona@westnet.com.au
Guest
Posts: n/a
 
      28th May 2007
Hello all

I have been struggling with filtering some data based on two criteria.

I have used Ron de Bruin's excellent resource at http://www.rondebruin.nl/copy5.htm
as a base but unfortunately I can't seem to get it to work on showing
me the data where a date falls between two ranges.

I have a worksheet containing data in Columns A to M. Column I
contains "Yes" or is blank. Column K contains a Date in DD/MM/YYYY
format or is blank.

I need to be able to create a new worksheet with records copied from
the original sheet that have only those records that contain both Yes
from column I and falls within a date range specified by the user.

Filtering by Yes is no dramas. As soo as I try to filter on date I
end up with the headers on a new sheet but no records at all
regardless of whether it is a single date or a range.

One of my attempts includes the code:

rng.AutoFilter Field:=11, Criteria1:="> 2007/05/11", _
Operator:=xlOr, Criteria2:="< 2007/05/25"
rng.AutoFilter Field:=9, Criteria1:="=Yes"

Any suggestions?

Thanks in advance

David

 
Reply With Quote
 
 
 
 
paul.robinson@it-tallaght.ie
Guest
Posts: n/a
 
      28th May 2007
Hi
Filtering on dates searches for text strings, not Dates as such. Your
filter is looking for a string like "2007/05/11", in a column with
date format DD/MM/YYYY, which is not the same kind of string. So
either change your filter to match the date format or vice versa.
regards
Paul

On May 28, 9:55 am, exwrex...@westnet.com.au wrote:
> Hello all
>
> I have been struggling with filtering some data based on two criteria.
>
> I have used Ron de Bruin's excellent resource athttp://www.rondebruin.nl/copy5.htm
> as a base but unfortunately I can't seem to get it to work on showing
> me the data where a date falls between two ranges.
>
> I have a worksheet containing data in Columns A to M. Column I
> contains "Yes" or is blank. Column K contains a Date in DD/MM/YYYY
> format or is blank.
>
> I need to be able to create a new worksheet with records copied from
> the original sheet that have only those records that contain both Yes
> from column I and falls within a date range specified by the user.
>
> Filtering by Yes is no dramas. As soo as I try to filter on date I
> end up with the headers on a new sheet but no records at all
> regardless of whether it is a single date or a range.
>
> One of my attempts includes the code:
>
> rng.AutoFilter Field:=11, Criteria1:="> 2007/05/11", _
> Operator:=xlOr, Criteria2:="< 2007/05/25"
> rng.AutoFilter Field:=9, Criteria1:="=Yes"
>
> Any suggestions?
>
> Thanks in advance
>
> David



 
Reply With Quote
 
Ron de Bruin
Guest
Posts: n/a
 
      28th May 2007
Hi David

You can also use this from my site

rng.AutoFilter Field:=4, Criteria1:=">=" & DateSerial(1947, 2, 23), _
Operator:=xlOr, Criteria2:="<=" & DateSerial(1988, 5, 7) ' yyyy-mm-dd format


And try EasyFilter there are a lot of Date filter options in this add-in
http://www.rondebruin.nl/easyfilter.htm


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


<(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> Hello all
>
> I have been struggling with filtering some data based on two criteria.
>
> I have used Ron de Bruin's excellent resource at http://www.rondebruin.nl/copy5.htm
> as a base but unfortunately I can't seem to get it to work on showing
> me the data where a date falls between two ranges.
>
> I have a worksheet containing data in Columns A to M. Column I
> contains "Yes" or is blank. Column K contains a Date in DD/MM/YYYY
> format or is blank.
>
> I need to be able to create a new worksheet with records copied from
> the original sheet that have only those records that contain both Yes
> from column I and falls within a date range specified by the user.
>
> Filtering by Yes is no dramas. As soo as I try to filter on date I
> end up with the headers on a new sheet but no records at all
> regardless of whether it is a single date or a range.
>
> One of my attempts includes the code:
>
> rng.AutoFilter Field:=11, Criteria1:="> 2007/05/11", _
> Operator:=xlOr, Criteria2:="< 2007/05/25"
> rng.AutoFilter Field:=9, Criteria1:="=Yes"
>
> Any suggestions?
>
> Thanks in advance
>
> David
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Query using date range entered by user Pam Microsoft Access Queries 2 7th Dec 2008 10:22 AM
Dates - Need to display date one month prior to user-entered date brettopp Microsoft Excel Worksheet Functions 13 3rd Dec 2007 05:58 PM
getting date range from user-entered date =?Utf-8?B?U2VyZW4=?= Microsoft Access Form Coding 2 15th Nov 2005 06:50 PM
How do I get the date range that must be entered for my query to . =?Utf-8?B?U3VlIENvbXBlbGxpbmc=?= Microsoft Access Reports 4 13th Feb 2005 09:27 PM
Date Range (year from entered date) =?Utf-8?B?YWNjZXNzcXVlc3Rpb24=?= Microsoft Access Queries 4 10th Dec 2004 06:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:47 AM.