Results 1 to 6 of 6

Looping through in Pivot table Filter fields

Threaded View

  1. #1
    Registered User
    Join Date
    07-05-2016
    Location
    Berlin, Germany
    MS-Off Ver
    2010
    Posts
    3

    Looping through in Pivot table Filter fields

    Hey guys,

    I have a big problem and I hope that you can help me I want to print all of the filter fields (all of the offers) in a pivot table, and print the tables one below another to the same page. I´m trying with the following code:

    
    Dim PvtTbl1 As PivotTable
    Dim pvtFld1 As PivotField
    Dim pi1 As PivotItem
    Dim wsData1 As Worksheet
    Dim rngData1 As Range
    Dim PvtTblCache1 As PivotCache
    Dim wsPvtTbl1 As Worksheet
    
    
    Set wsData1 = Worksheets("Uber")
    Set wsPvtTbl1 = Worksheets("Uber_opt")
    Set rngData1 = wsData1.Range("A1").CurrentRegion
    
    
    ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:=rngData1, Version:=xlPivotTableVersion12).CreatePivotTable TableDestination:=wsPvtTbl1.Range("A1"), TableName:="Uber_pivot"
    Set PvtTbl1 = wsPvtTbl1.PivotTables("Uber_pivot")
    
    
    
    Set pvtFld1 = PvtTbl1.PivotFields("offer")
    pvtFld1.Orientation = xlPageField
    
    Set pvtFld1 = PvtTbl1.PivotFields("publisher")
    pvtFld1.Orientation = xlRowField
    
    Set pvtFld1 = PvtTbl1.PivotFields("conversions")
    pvtFld1.Orientation = xlDataField
    
    
    Set pvtFld1 = PvtTbl1.PivotFields("revenue")
    pvtFld1.Orientation = xlDataField
    
    With PvtTbl1.PivotFields("First Ride")
    .Orientation = xlDataField
    .Function = xlSum
    .NumberFormat = "#,##0"
    .Position = 1
    End With
    
    For Each pi1 In PvtTbl1.PageFields("offer").PivotItems
    PvtTbl1.PageFields("offer").CurrentPage = pi1.Name
    PvtTbl1.ManualUpdate = True
    
    Range("A3").End(xlDown).Offset(3, 0).Select
    
    
    Next pi1
    The code rolls down to the last item in the Filter field and prints only that table instead of all of them. Can you help me, please?

    Thank you,

    Best,

    Dani
    Last edited by zsirsaman; 07-06-2016 at 03:54 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. looping through pivot table filter
    By ShaliniGomes in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-25-2014, 12:02 AM
  2. Pivot Table, Looping through Filter
    By noobtime in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2013, 05:53 PM
  3. Pivot Table filter with added fields?
    By rbpd5015 in forum Excel General
    Replies: 3
    Last Post: 08-17-2010, 02:10 PM
  4. Pivot Table - Looping Through Pivot Fields
    By mini12 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-07-2009, 09:49 AM
  5. [SOLVED] Looping page fields in pivot table
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-13-2006, 08:50 PM
  6. [SOLVED] Looping page fields in pivot table
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2006, 06:15 PM
  7. [SOLVED] How do I set up filter for page fields in pivot table?
    By Mitsycat in forum Excel General
    Replies: 3
    Last Post: 05-06-2005, 06:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1