Hi,
I have a pivot table in a sheet. It has hours into it. I want to select All hours and then uncheck zero and blank hours. I am using the below vba code but it does nto work as expected.
Sub FilterPivotHours()
currentWorkBookName = ThisWorkbook.Name
Workbooks(currentWorkBookName).Sheets("Pivot").Activate
ActiveSheet.PivotTables("PivotTable1").PivotFields("Hours"). _
CurrentPage = "(All)"
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Hours")
On Error Resume Next
.PivotItems("(All)").Visible = True
.PivotItems("0").Visible = False
.PivotItems("(blank)").Visible = False
On Error GoTo 0
End With
End Sub
Regards
Rajaniesh
I have a pivot table in a sheet. It has hours into it. I want to select All hours and then uncheck zero and blank hours. I am using the below vba code but it does nto work as expected.
Sub FilterPivotHours()
currentWorkBookName = ThisWorkbook.Name
Workbooks(currentWorkBookName).Sheets("Pivot").Activate
ActiveSheet.PivotTables("PivotTable1").PivotFields("Hours"). _
CurrentPage = "(All)"
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Hours")
On Error Resume Next
.PivotItems("(All)").Visible = True
.PivotItems("0").Visible = False
.PivotItems("(blank)").Visible = False
On Error GoTo 0
End With
End Sub
Regards
Rajaniesh