Results 1 to 4 of 4

Thread: pivot table pagefield

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    9

    pivot table pagefield

    Hi,
    I have a pivot table which stores data for each date on a separate page, ie the page field in the pivot table is the date. Now I want to increment the page fields through VBA. All I can find is a current page method. I cannot do it otherwise because my data keeps changing and I dont know what dates I got, so this has to be generically.
    Any ideas,
    thx
    Sunil.

  2. #2
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    Something like this :-

    '-----------------------------------------
    For Each Pi In ActiveSheet.PivotTables("PivotTable1"). _
    PivotFields("Type").PivotItems
    MsgBox (Pi)
    Next
    '-----------------------------------------
    Regards
    BrianB
    -------------------------------

  3. #3
    Addicted Member
    Join Date
    Aug 2002
    Location
    Luton, UK
    Posts
    178
    Sorry, got distracted and didn't finish it off :-

    '-----------------------------------------
    Dim pt As PivotTable
    Dim PF As PivotField
    Set pt = ActiveSheet.PivotTables("PivotTable1")
    Set PF = pt.PivotFields("Type")
    '--------------------
    For Each Pi In PF.PivotItems
    PF.CurrentPage = Pi
    MsgBox (Pi)
    Next
    '-----------------------------------------
    Regards
    BrianB
    -------------------------------

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    9
    hmm, tried that earlier as well, but the code is giving me an error.
    The error is "Unable to set the _default property of the pivotitem class".

    I looked at the object browser for the _default class, its under hidden members. But the help for this didnt reveal much.

    What do you think?

    Thx for replying,

    Sunil.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width