VBA Filter Pivot Table

NDSWA

New Member
Joined
Sep 8, 2015
Messages
4
Hello! I have a macro below that is supposed to filter out all 'no data' ("") values. The data set will be added to constantly so I want new values to be included but I don't want blanks. However, the macro returns Error 1004: Unable to get the PivotItems property of the PivotField class.

Please note that the "" value exists in the raw data so there should be no reason why it's erroring out. Is something wrong with my notation in 'PivotFields'? Thanks very much!

Macro:
Sub Test()
Sheets("ABC").Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Name XYZ")
.PivotItems("").Visible = False
End With

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I have a macro that works using the same wording you wrote

.PivotItems("").Visible = False

Question, could it come back as blank?
If so try
.PivotItems("blank").Visible = False

Just a thought
 
Upvote 0

Forum statistics

Threads
1,217,302
Messages
6,135,721
Members
449,959
Latest member
choy96

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top