Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I found this code published by Debra Dalgleish. I've tried unsuccessfully to
modify it for my file. Sub HideZeroRowTotals() 'hide rows that contain zero totals 'by Debra Dalgleish Dim r As Integer Dim rTop As Integer Dim i As Integer Dim pt As PivotTable Dim pf As PivotField Dim df As PivotField Dim pi As PivotItem Dim pd As Range Dim str As String Set pt = Sheets("Summary Pivot").PivotTables(1) Set df = pt.PivotFields("2005 Vol") 'data field Set pf = pt.PivotFields("Customer") 'column field rTop = 7 'number of rows before data starts For Each pi In pf.PivotItems On Error Resume Next pi.Visible = True Next pi i = pf.PivotItems.Count + rTop For r = i To rTop - 1 Step -1 On Error Resume Next str = Cells(r, 1).Value Set pd = pt.GetPivotData(df.Value, pf.Value, str) If pd.Value = 0 Then pf.PivotItems(str).Visible = False End If Next r I have changed the sheet and field names. The difference is that I have 2 row fields and just wasn't sure how to add that to the code. The macro works perfectly if I only have the one row field, but I need to include another row field called "segment". Thanks for your help! -- maryj |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hide all values in a row if value is 0 | Excel Worksheet Functions | |||
I Need a formula to evaluate a cell with + or - values | Excel Worksheet Functions | |||
Return Range of Numerical Values in Single Column based on Frequency Percentage | Excel Worksheet Functions | |||
How do I hide 0 values in line charts | Charts and Charting in Excel | |||
Excel - hide erroer values | Excel Discussion (Misc queries) |