View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Hong Quach Hong Quach is offline
external usenet poster
 
Posts: 21
Default Pivot Page field filter based on cell value

Hi,

I am not quite understand your situtation described below. My guess is that
you want a macro that will do the following:
1. Set all pt to filter on "All"
2. If all pt contains a "CHOOSEN_VALUE" in the
pt.pagefields("CHOOSEN_FIELD") Then
a. Change all pt to filter on the "CHOOSEN_VALUE"
Else
a. Change all pt back to filter on "All"
3. End If

If what describe here would work for you, then you can make a label at the
bottom of the code to change all pt to filter on "All", then use the "On
Error Goto <Lable" to reset all pt back to filter on "All".

Private Sub FilterPTOnAll()
' Code to loop through each pt and set the filter to All
End Sub

Sub YourMacro()
FilterPTOnAll
On Error Goto ResetPT

' Code to loop through each pt and set the filter to the "CHOOSEN_VALUE"

Exit Sub
ResetPT:
FilterPTOnAll
End Sub

Hong Quach

"Michel" wrote:

The error resume next - error goto 0 is not solution I can use. He the
chooses the default filter "All" so every value is shown. What I want him to
do his quite making the specific pivottable. Is this something which is
possible:

So how to program a macro which indicates that if a cell value is not in the
page field list, he should not create the pivot, and if it is in the
pagefield list, he should create it.