Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Programming the filter of a pivot table

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 !!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Programming the filter of a pivot table

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 !!



  #3   Report Post  
Posted to microsoft.public.excel.programming
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 !!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Programming the filter of a pivot table



"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 !!




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Programming the filter of a pivot table

does your pivot table filter correctly if you filter manually?

Are your dates in the right format and are they properly recognised as Excel
dates? I am wondering if there is a link with the problem that I am
experiencing (see my post 'Texttocolumns and Date Format using Macro - UK
International setti ngs'
http://www.microsoft.com/office/comm...b-937ad3c07c79 )

--
KenY


"Jean-Marc P" wrote:

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 !!



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default Programming the filter of a pivot table

JEan-Marc,

Sorry for misunderstanding your question.

Insert another column into your database, and use a formula like

=AND(I2=TODAY(),I2<=DATE(YEAR(TODAY()),MONTH(TODA Y()) +4,DAY(TODAY())))

(this is assuming that your dates are in column I)

Then use that column (which will return TRUE and FALSE) as either a row or page filter, and select
only TRUE.

In code, you could do that like this:

Range("J1").Value = "Include"
Range("J2:J" & Cells(Rows.Count, 9).End(xlUp).Row).FormulaR1C1 = _
"=AND(RC[-1]=TODAY(),RC[-1]<=DATE(YEAR(TODAY()),MONTH(TODAY()) +4,DAY(TODAY())))"

which will put that formula into column J, matching the entries in column I.

HTH,
Bernie
MS Excel MVP


"Jean-Marc P" wrote in message
...
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 !!






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Programming the filter of a pivot table

Manual filter (auto filer) works fine !?!? Doesn't seem to be the same pb

"KenY" wrote:

does your pivot table filter correctly if you filter manually?

Are your dates in the right format and are they properly recognised as Excel
dates? I am wondering if there is a link with the problem that I am
experiencing (see my post 'Texttocolumns and Date Format using Macro - UK
International setti ngs'
http://www.microsoft.com/office/comm...b-937ad3c07c79 )

--
KenY


"Jean-Marc P" wrote:

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 !!

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
Pivot Table Programming (Selecting Pivot Items) Manish Jaitly[_2_] Excel Programming 0 May 30th 07 10:51 AM
Pivot table programming havocdragon Excel Programming 1 September 14th 06 02:57 PM
Pivot Table Programming Matt Childs Excel Programming 2 October 21st 05 06:22 PM
Pivot Table Programming Marvin Excel Programming 1 January 25th 05 10:54 PM
Pivot table Programming Kris Excel Programming 1 October 5th 04 09:03 PM


All times are GMT +1. The time now is 04:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"