ChrisMcIntyre
New Member
- Joined
- Jan 6, 2022
- Messages
- 37
- Office Version
- 365
- 2016
- Platform
- Windows
Hi there, and right off the bat, I am still a total newbie to VBA and now Pivot Tables too.
I have the following code setup in my workbook, and it's doing everyting I want except hide the "(blank)" entries.
It should refesh all the tables first, then reset the filters in "Row" field so all items are selected, then it should uncheck anything labelled "(blank)".
Any ideas how I can hide those pesky blanks please?
Thanks, Chris.
Sub REFRESH_PIVOTS()
'Refresh PivotTables
ActiveWorkbook.REFRESHALL
Dim pt As PivotTable
Dim pf As PivotField
Set pt = ActiveSheet.PivotTables("PivotTable9")
Set pf = pt.PivotFields("Row")
With pf
.ClearAllFilters
On Error Resume Next
.PivotItems("(blank)").Visible = False
On Error GoTo 0
End With
End Sub
I have the following code setup in my workbook, and it's doing everyting I want except hide the "(blank)" entries.
It should refesh all the tables first, then reset the filters in "Row" field so all items are selected, then it should uncheck anything labelled "(blank)".
Any ideas how I can hide those pesky blanks please?
Thanks, Chris.
Sub REFRESH_PIVOTS()
'Refresh PivotTables
ActiveWorkbook.REFRESHALL
Dim pt As PivotTable
Dim pf As PivotField
Set pt = ActiveSheet.PivotTables("PivotTable9")
Set pf = pt.PivotFields("Row")
With pf
.ClearAllFilters
On Error Resume Next
.PivotItems("(blank)").Visible = False
On Error GoTo 0
End With
End Sub