Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Blobbies
 
Posts: n/a
Default AutoFilter, using "Today's Date"

Kia Ora from NZ

I would like a macro that filters out rows depending on todays date - i.e.
one that will show all the rows, if they have the present date in a
particular column.

I've managed this much on my own ....

Sub ShowAllOverdueFiles()
'
' ShowAllOverdueFiles Macro
' Macro recorded 29/01/2006 by Mike
'

'

Selection.AutoFilter Field:=6, Criteria1:="<" & Range("V1").Value,
Operator:=xlAnd

Range("a2").Select

End Sub


However, when I run that, all my rows disappear. BUT, if I go to the Custom
Autofilter option, the autofilter is there for today's date, and it works
when you press OK.

I guess I just need to know how the macro can execute itself, right through
to the end!

Many thanks in advance!


Mike

  #2   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default AutoFilter, using "Today's Date"

Hi Kia Ora,

Try changing:

Range("V1").Value

to

CLng(Range("V1").Value)


---
Regards,
Norman



"Blobbies" wrote in message
...
Kia Ora from NZ

I would like a macro that filters out rows depending on todays date - i.e.
one that will show all the rows, if they have the present date in a
particular column.

I've managed this much on my own ....

Sub ShowAllOverdueFiles()
'
' ShowAllOverdueFiles Macro
' Macro recorded 29/01/2006 by Mike
'

'

Selection.AutoFilter Field:=6, Criteria1:="<" & Range("V1").Value,
Operator:=xlAnd

Range("a2").Select

End Sub


However, when I run that, all my rows disappear. BUT, if I go to the
Custom
Autofilter option, the autofilter is there for today's date, and it works
when you press OK.

I guess I just need to know how the macro can execute itself, right
through
to the end!

Many thanks in advance!


Mike



  #3   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default AutoFilter, using "Today's Date"

Hi Mike,

Forgive my ignorance of Maori salutations!


---
Regards,
Norman


  #4   Report Post  
Posted to microsoft.public.excel.misc
Blobbies
 
Posts: n/a
Default AutoFilter, using "Today's Date"

thanks NJ

that's just beautiful!

i've been struggling with this all day!!

What exactly does the "CLng" do?? or do I need not know!??



cheers

mike



"Norman Jones" wrote:

Hi Kia Ora,

Try changing:

Range("V1").Value

to

CLng(Range("V1").Value)


---
Regards,
Norman



"Blobbies" wrote in message
...
Kia Ora from NZ

I would like a macro that filters out rows depending on todays date - i.e.
one that will show all the rows, if they have the present date in a
particular column.

I've managed this much on my own ....

Sub ShowAllOverdueFiles()
'
' ShowAllOverdueFiles Macro
' Macro recorded 29/01/2006 by Mike
'

'

Selection.AutoFilter Field:=6, Criteria1:="<" & Range("V1").Value,
Operator:=xlAnd

Range("a2").Select

End Sub


However, when I run that, all my rows disappear. BUT, if I go to the
Custom
Autofilter option, the autofilter is there for today's date, and it works
when you press OK.

I guess I just need to know how the macro can execute itself, right
through
to the end!

Many thanks in advance!


Mike




  #5   Report Post  
Posted to microsoft.public.excel.misc
Norman Jones
 
Posts: n/a
Default AutoFilter, using "Today's Date"

Hi Mike,

The CLng conversion function converts the value to an integer. Using non US
style dates, I need to pass dates to the autofilter in the form of long
integers.

When the same operation is performed manually, Excel performs this operation
implicitly. VBA is, however, US-centric in its interpretation and treatment
of dates.

--
---
Regards,
Norman



"Blobbies" wrote in message
...
thanks NJ

that's just beautiful!

i've been struggling with this all day!!

What exactly does the "CLng" do?? or do I need not know!??



cheers

mike



"Norman Jones" wrote:

Hi Kia Ora,

Try changing:

Range("V1").Value

to

CLng(Range("V1").Value)


---
Regards,
Norman



"Blobbies" wrote in message
...
Kia Ora from NZ

I would like a macro that filters out rows depending on todays date -
i.e.
one that will show all the rows, if they have the present date in a
particular column.

I've managed this much on my own ....

Sub ShowAllOverdueFiles()
'
' ShowAllOverdueFiles Macro
' Macro recorded 29/01/2006 by Mike
'

'

Selection.AutoFilter Field:=6, Criteria1:="<" & Range("V1").Value,
Operator:=xlAnd

Range("a2").Select

End Sub


However, when I run that, all my rows disappear. BUT, if I go to the
Custom
Autofilter option, the autofilter is there for today's date, and it
works
when you press OK.

I guess I just need to know how the macro can execute itself, right
through
to the end!

Many thanks in advance!


Mike






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
Copy/Paste in Autofilter honyacker Excel Discussion (Misc queries) 2 January 12th 06 03:38 PM
Autofilter not working correctly... Emily Excel Discussion (Misc queries) 0 January 11th 06 11:37 PM
AutoFilter - non adjacent columns Richard Excel Discussion (Misc queries) 4 August 15th 05 01:15 PM
Using AutoFilter with worksheet protection in 2000 vs. 2003 gncook Excel Discussion (Misc queries) 3 July 25th 05 09:02 PM
Strange Results with Autofilter Joyce Excel Discussion (Misc queries) 1 January 17th 05 03:42 AM


All times are GMT +1. The time now is 06:42 AM.

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"