View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Jean-Marc P Jean-Marc P is offline
external usenet poster
 
Posts: 7
Default Programming the filter of a pivot table

The problem isn't to filter the list. Both your code & mine works fine. But
either way, when I update the pivot table related to that list, filtered &
unfiltered lines all show into the pivot table. I only want the ones in the
right date range.

"Bernie Deitrick" wrote:

This works for me:

Selection.AutoFilter Field:=9, Criteria1:="=" & Now(), Operator:=xlAnd, _
Criteria2:="<=" & Now() + 122

--
HTH,
Bernie
MS Excel MVP


"Jean-Marc P" wrote in message
...
I just can't get through this ... I've spent hours on it & I'm sure it's very
simple !!

I download a (.txt) file with tons dates of events in it. Once this is done,
i run a macro that does numerous things, including filter the list & then
refresh the pivot table. Info that have been filtered in the list still
appear in the pivot table. How can I get rid of them ? (I join the part of
the code where I filter & refresh)

'filter the list to get the next 4 months
Selection.AutoFilter Field:=9, Criteria1:="=today()", Operator:=xlAnd _
, Criteria2:="<=TODAY()+122"
'refresh the pivottable
Sheets("Dynamique").Select
ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotCache.Refresh

Please help me !!