View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Advanced filter on last months results

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