Consulting

Results 1 to 2 of 2

Thread: Show All in PivotTable

  1. #1
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location

    Show All in PivotTable

    I am having 2 problems with code on a PivotTable. If I Record New Macro this is what I get:

    [VBA]ActiveSheet.PivotTables("PivotTable1").PivotFields("Cust#").CurrentPage = _
    "(All)"[/VBA]

    I changed that into this:

    [VBA]On Error Resume Next
    pvtTable.PivotFields("Customer#").CurrentPage = _
    "(All)"[/VBA]

    neither one works when I run the code. Also I created this to unhide items in a Pivot Table:

    [VBA]Sub ShowPivotField(ByVal pvtField As String)
    Dim pvtItem As PivotItem
    For Each pvtItem In pvtTable.PivotFields(pvtField).PivotItems
    pvtItem.Visible = True
    Next

    Set pvtItem = Nothing
    End Sub[/VBA]

    [VBA]ShowPivotField "Product"
    ShowPivotField "Code"
    ShowPivotField "Delivered Price"
    ShowPivotField "Pick-Up Allowance/Case"
    ShowPivotField "FOB Price"
    ShowPivotField "Minimum Delivery"
    ShowPivotField "Begin Contract"
    ShowPivotField "End Contract"
    ShowPivotField "Whse"
    ShowPivotField "Chain"
    ShowPivotField "Brand"
    ShowPivotField "Contact"
    ShowPivotField "SlsPersn"
    ShowPivotField "Cust"[/VBA]

    They all work up to ShowPivotField "Minimum Delivery", which I checked ten times the name is exactly the same. Here is a sample workbook to test for both problems.

  2. #2
    VBAX Master
    Joined
    Jun 2006
    Posts
    1,091
    Location
    Actually,

    For some reason the first part just started working and I didn't change anything but I still can't see the second part.

Posting Permissions

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