Consulting

Results 1 to 2 of 2

Thread: hide 0 values in pivot table

  1. #1

    hide 0 values in pivot table

    Hello

    The "World" field is in one column and the "Total" field is in another column. I want to make my pivot table to not show data from "World" that has the value "0" in the "Total" field. This is my code :

    [vba]For Each PivItem In _
    PT.PivotFields("World").PivotItems
    PivItem.Visible = True
    Next PivItem

    ' Now - loop through and keep only certain items visible
    For Each PivItem In _
    PT.PivotFields("World").PivotItems
    Select Case PivItem.Name
    Case "-", "(blank)"
    PivItem.Visible = False
    Case PivItem.Value = 0
    PivItem.Visible = False
    Case Else
    PivItem.Visible = True
    End Select
    Next PivItem[/vba]
    Pretty please help me kind souls
    Last edited by Aussiebear; 01-09-2012 at 11:25 PM. Reason: Added tags to code

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master xld's Avatar
    Joined
    Apr 2005
    Posts
    25,147
    Location
    Wouldn't you just hide the row item for the zeroes? What is the row label?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

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