VBA to filter blank rows in a Pivot table

SanjayGMusafir

Well-known Member
Joined
Sep 7, 2018
Messages
1,462
Office Version
  1. 2021
Platform
  1. MacOS
Hi Experts
I'm using following code to filter blank rows. The code deals with two Pivot tables simultaneously based on a same table.
But the code is not filtering blank rows.
Please help
Thanks a lot

VBA Code:
'To Filter Blank Records
    On Error Resume Next
    With ActiveSheet.PivotTables("MFPlan").PivotField("Name").PivotItems("(blank)").Visible = False
    End With
    With ActiveSheet.PivotTables("MFAnalysis").PivotField("Plan").PivotItems("(blank)").Visible = False
    End With
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Try it without the With/End With statements, and it should be PivotFields not PivotField...

VBA Code:
    ActiveSheet.PivotTables("MFPlan").PivotFields("Name").PivotItems("(blank)").Visible = False
  
    ActiveSheet.PivotTables("MFAnalysis").PivotFields("Plan").PivotItems("(blank)").Visible = False

Hope this helps!
 
Upvote 0
Solution

Forum statistics

Threads
1,215,751
Messages
6,126,671
Members
449,326
Latest member
asp123

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