View Single Post
  #13   Report Post  
Posted to microsoft.public.excel.programming
[email protected] paul.robinson@it-tallaght.ie is offline
external usenet poster
 
Posts: 789
Default Pivot Table - change page field help

Hi
I was assuming (and so was everyone else I suspect) that your code was
in a general code module. In the VB editor go to Insert, Module. Paste
your code in there and see how it goes.
The code module behind each sheet is only to run code that activates
when something about the sheet changes. As you say, there is no need
to refer to the sheet name under those conditions, but you are only
allowed to run subs with specific names not some general sub.
regards
Paul


On Mar 12, 7:51*pm, Opal wrote:
On Mar 12, 3:06*pm, wrote:





Hi
Change Activesheet to your sheet name e.g. Worksheets ("MySheet"). If
you only have 2 sheets to look at you will do the remove the loop bit
and do the pagefield change for each pivot table separately.
regards
paul


On Mar 12, 6:51*pm, Opal wrote:


On Mar 11, 10:14*am, "Roger Govier"


<roger@technology4unospamdotcodotuk wrote:
Hi


It worked perfectly for me.
If you would like to mail me a copy of your workbook, I would be interested
in seeing why it wouldn't work in your case.
To mail direct, send to
roger at technology4u dot co dot uk
Change the at and dots to make valid email address


--
Regards
Roger Govier


"Opal" wrote in message


...


Thank you for the follow-up, Roger, but it still didn't work....
I got this working:


Sub PartNoChart1()


Dim PartNo As String


On Error Resume Next
PartNo = Sheets("FSChart1").Range("A1").Value
Sheets("FSChart1").PivotTables("PT1").PivotFields
("PARTNO").CurrentPage = PartNo
Sheets("FSChart1").PivotTables("PT2").PivotFields
("PARTNO").CurrentPage = PartNo


End Sub- Hide quoted text -


- Show quoted text -


I appreciate your offer to go that extra mile for me,
unfortunately, the data is proprietory and I cannot
send it off to you.


However, I do have a question about the line:


For Each pt In ActiveSheet.PivotTables


The sheet with the pivot tables would not be my
active sheet. *The tables are in other work
sheets and feed charts found on my main sheet
in the workbook. *There are 11 worksheets in
total with various pivots feeding charts on the
main sheet.- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -


So, Paul, if the routine is pasted on the sheet
where I want the pivot tables to change, I still have
to change ActiveSheet to WorkSheet("MySheet")...?- Hide quoted text -

- Show quoted text -