Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default VBA for Date custom Filter

Hi

I am using Excel 2003 and what to do a custom filter on a date range through
VBA.

I am using the code below but when I look at the sheet no data is displayed
if I look at the custom filter option on the field the setting are there and
if I click on OK the data will then display. It is like the custom filter
through the code is not be executed / refreshed but the criteria is going
into the correct place.

Sub DateFilter()
vFilter = Range("DateAssigned").Value
vFilter2 = Range("DateAssigned2").Value
Sheets("DCR").Select
Selection.AutoFilter Field:=2, Criteria1:="=" & Format(vFilter,
"dd/mm/yyyy"), Operator:= _
xlAnd, Criteria2:="<=" & Format(vFilter2, "dd/mm/yyyy")
End sub

Thanks
Ailish
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 105
Default VBA for Date custom Filter

Hi.
Change your formats to "mm/dd/yyyy", whatever the displayed format.
HTH
Daniel

Hi

I am using Excel 2003 and what to do a custom filter on a date range through
VBA.

I am using the code below but when I look at the sheet no data is displayed
if I look at the custom filter option on the field the setting are there and
if I click on OK the data will then display. It is like the custom filter
through the code is not be executed / refreshed but the criteria is going
into the correct place.

Sub DateFilter()
vFilter = Range("DateAssigned").Value
vFilter2 = Range("DateAssigned2").Value
Sheets("DCR").Select
Selection.AutoFilter Field:=2, Criteria1:="=" & Format(vFilter,
"dd/mm/yyyy"), Operator:= _
xlAnd, Criteria2:="<=" & Format(vFilter2, "dd/mm/yyyy")
End sub

Thanks
Ailish



  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default VBA for Date custom Filter

Hi Daniel

I have the format on the criteria areas as I am in Ireland the dd/mm/yyyy
format is ok but should I be putting it somewhere else as well?

Thanks

"Daniel.C" wrote:

Hi.
Change your formats to "mm/dd/yyyy", whatever the displayed format.
HTH
Daniel

Hi

I am using Excel 2003 and what to do a custom filter on a date range through
VBA.

I am using the code below but when I look at the sheet no data is displayed
if I look at the custom filter option on the field the setting are there and
if I click on OK the data will then display. It is like the custom filter
through the code is not be executed / refreshed but the criteria is going
into the correct place.

Sub DateFilter()
vFilter = Range("DateAssigned").Value
vFilter2 = Range("DateAssigned2").Value
Sheets("DCR").Select
Selection.AutoFilter Field:=2, Criteria1:="=" & Format(vFilter,
"dd/mm/yyyy"), Operator:= _
xlAnd, Criteria2:="<=" & Format(vFilter2, "dd/mm/yyyy")
End sub

Thanks
Ailish




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 21
Default VBA for Date custom Filter

Hi Daniel

Sorry misunderstood and change the setting to mm/dd/yyyy and it worked
perfectly.

thanks

"Ailish" wrote:

Hi Daniel

I have the format on the criteria areas as I am in Ireland the dd/mm/yyyy
format is ok but should I be putting it somewhere else as well?

Thanks

"Daniel.C" wrote:

Hi.
Change your formats to "mm/dd/yyyy", whatever the displayed format.
HTH
Daniel

Hi

I am using Excel 2003 and what to do a custom filter on a date range through
VBA.

I am using the code below but when I look at the sheet no data is displayed
if I look at the custom filter option on the field the setting are there and
if I click on OK the data will then display. It is like the custom filter
through the code is not be executed / refreshed but the criteria is going
into the correct place.

Sub DateFilter()
vFilter = Range("DateAssigned").Value
vFilter2 = Range("DateAssigned2").Value
Sheets("DCR").Select
Selection.AutoFilter Field:=2, Criteria1:="=" & Format(vFilter,
"dd/mm/yyyy"), Operator:= _
xlAnd, Criteria2:="<=" & Format(vFilter2, "dd/mm/yyyy")
End sub

Thanks
Ailish




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
Custom filter date using VB Kevin Excel Discussion (Misc queries) 1 March 29th 08 07:05 PM
Custom Filter? Steve B Excel Discussion (Misc queries) 2 June 29th 07 09:18 PM
Custom Filter Shams Excel Worksheet Functions 4 July 11th 06 08:36 PM
Custom Filter Rao Ratan Singh New Users to Excel 3 June 16th 06 01:36 PM
Custom Filter Rob Excel Discussion (Misc queries) 18 April 5th 06 03:49 PM


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