View Single Post
  #3   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

You could use code to hide the calculated items that are zero. For example:

'=====================================
Sub HideZeroCalcItems()
'hide rows that contain zeros for calculated items
Dim r As Integer
Dim i As Integer
Dim pt As PivotTable
Dim pf1 As PivotField
Dim pf2 As PivotField
Dim df As PivotField
Dim pi As PivotItem
Dim pi2 As PivotItem
Dim pd As Range
Dim str As String
Set pt = Sheets("Pivot").PivotTables(1)
Set df = pt.PivotFields("Units") 'data field
Set pf1 = pt.PivotFields("Item") 'column field
Set pf2 = pt.PivotFields("Rep") 'row field
Set pi = pf1.PivotItems("YearVar") 'calculated item

For Each pi2 In pf2.PivotItems
pi2.Visible = True
Next pi2

i = pf2.PivotItems.Count
For r = i To 1 Step -1
On Error Resume Next
str = Cells(r + 5, 1).Value
Set pd = pt.GetPivotData(df.Value, pf1.Value, _
pi.Value, pf2.Value, str)
If pd.Value = 0 Then
pf2.PivotItems(str).Visible = False
End If
Next r

End Sub

'===================================


Greg Bobak wrote:
The set-up; (Example only....scenario is much larger) I have a pivot the is
summing the voting results for the state of PA in in 3-categories, appearing
in cells B1 through B3.
Cells A1 through A3 have the 3 categories Democratic, Republican
&Independant.
The problem: The Independant has a null values for its CALCULATED
results(the cell is blank). However, The pivot is showing the name
INDEPENDANT in the pivot.
How can I have the pivot not to show indenpendant without constantly using
the drop-down box to un-check the unwanted value. (again, my actual scenrio
has over 500 constantly changing values. Let me know. Thanks!



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html