Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dd dd is offline
external usenet poster
 
Posts: 95
Default Custom Filter by Daterange or Month

I want to filter a column of data by a date range or month and allow the
user to enter a beginning and end date (or a month number). U using the
record macro button I have created the following macro.

Sub OPI_FilterbyTargetDate()
'
' OPI_FilterbyTargetDate Macro
' Macro recorded 05/04/2007 by Dylan D

Selection.AutoFilter Field:=22, Criteria1:="=30/04/2007",
Operator:=xlAnd
End Sub

I want to bring up the custom filter dialog box to allow the user to enter a
date range.
How do I remove the text "Criteria1:="=30/04/2007"" and allow the user to
enter their own date range e.g., greater than 01-01-04 and less than
30-01-04.

Is there an easier way which will allow the users to enter the month number?

D Dawson



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Custom Filter by Daterange or Month

I think you're going to have to design your own input form using a userform
in the VBE. That will be some work as you'll have to parse/validate user
entries and then feed the dates into your macro. Personally I'd try to
train the users to use the built-in tools directly, if at all possible.

--
Jim
"dd" <dd.dd wrote in message
...
|I want to filter a column of data by a date range or month and allow the
| user to enter a beginning and end date (or a month number). U using the
| record macro button I have created the following macro.
|
| Sub OPI_FilterbyTargetDate()
| '
| ' OPI_FilterbyTargetDate Macro
| ' Macro recorded 05/04/2007 by Dylan D
|
| Selection.AutoFilter Field:=22, Criteria1:="=30/04/2007",
| Operator:=xlAnd
| End Sub
|
| I want to bring up the custom filter dialog box to allow the user to enter
a
| date range.
| How do I remove the text "Criteria1:="=30/04/2007"" and allow the user to
| enter their own date range e.g., greater than 01-01-04 and less than
| 30-01-04.
|
| Is there an easier way which will allow the users to enter the month
number?
|
| D Dawson
|
|
|


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Custom Filter by Daterange or Month

Hi DD,

Another way would be to enter your minimum date in a cell, say AA1,
and your max date in a second cell, AB1. Then change your macro statement
to:

Selection.AutoFilter Field:=1, Criteria1:="=" &
CDate(Range("AA1")), _
Operator:=xlAnd, Criteria2:="<=" & CDate(Range("AB1"))

CHORDially,
Art Farrell

"dd" <dd.dd wrote in message
...
I want to filter a column of data by a date range or month and allow the
user to enter a beginning and end date (or a month number). U using the
record macro button I have created the following macro.

Sub OPI_FilterbyTargetDate()
'
' OPI_FilterbyTargetDate Macro
' Macro recorded 05/04/2007 by Dylan D

Selection.AutoFilter Field:=22, Criteria1:="=30/04/2007",
Operator:=xlAnd
End Sub

I want to bring up the custom filter dialog box to allow the user to enter

a
date range.
How do I remove the text "Criteria1:="=30/04/2007"" and allow the user to
enter their own date range e.g., greater than 01-01-04 and less than
30-01-04.

Is there an easier way which will allow the users to enter the month

number?

D Dawson





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
DateRange Lookup no exact match, can't use lesser PAR Excel Worksheet Functions 4 January 13th 10 03:08 AM
Auto filter custom filter stevefromnaki Excel Worksheet Functions 2 December 30th 09 06:23 AM
Filter out unique additions month to month Rookie_User Excel Discussion (Misc queries) 3 March 13th 09 02:29 PM
check if a a date is in a specified daterange H. Nissen[_2_] Excel Worksheet Functions 4 October 30th 08 09:20 PM
Filter Month then name Pasty Excel Programming 6 March 23rd 07 09:51 AM


All times are GMT +1. The time now is 09:00 PM.

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"