Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro with custom autofilter for greater and less than specific da
Hi
I am trying to record a macro where I autofilter a column containing dates. I need to apply greater than and less than to get a specific month eg. greater than 11/01/06 and less than 11/30/06 to get the info for the month of november. When I record the macro and run it I find that there is no data displayed yet when I autofilter without the help of a macro then the information is there. Anyone have any ideas what I'm doing wrong? |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro with custom autofilter for greater and less than specific da
I'm not sure how you're getting the date, but sometimes making sure it's a Long
will help: .Range("a1").CurrentRegion.AutoFilter Field:=3, _ Criteria1:="=" & CLng(CDate(UserVal)) Sometimes using the same numberformat helps: .Range("a1").CurrentRegion.AutoFilter Field:=3, _ Criteria1:="=" & Format(CDate(UserVal),"mm/dd/yyyy") (try it for both dates) Peter-Jon wrote: Hi I am trying to record a macro where I autofilter a column containing dates. I need to apply greater than and less than to get a specific month eg. greater than 11/01/06 and less than 11/30/06 to get the info for the month of november. When I record the macro and run it I find that there is no data displayed yet when I autofilter without the help of a macro then the information is there. Anyone have any ideas what I'm doing wrong? -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|