Thread
:
Advanced filter on last months results
View Single Post
#
6
Posted to microsoft.public.excel.programming
[email protected]
external usenet poster
Posts: 21
Advanced filter on last months results
On Saturday, 28 December 2013 13:08:58 UTC, Claus Busch wrote:
Hi Eddie,
Am Sat, 28 Dec 2013 04:58:22 -0800 (PST) schrieb
:
Thanks for you suggestion I am using Excel 2003 and It look like xlFilterLastMonth will not work with this version?
then try:
Sub Test()
Dim StartD As Double
Dim EndD As Double
StartD = DateSerial(Year(Date), Month(Date) - 1, 1)
EndD = DateSerial(Year(Date), Month(Date), 0)
ActiveSheet.Range("D:D").AutoFilter Field:=1, Criteria1:= _
"=" & StartD, Operator:=xlAnd, Criteria2:="<=" & EndD
End Sub
Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
Thanks Claus
This did exactly what i need - your second suggention threw up a debug error on
EndD = WorksheetFunction.EoMonth(Date, -1)
But I will go with the VBA above.
Thanks once again for your wonderful help as usual
Eddie
Reply With Quote
[email protected]
View Public Profile
Find all posts by
[email protected]