VBA to filter blank rows in a Pivot table

SanjayGMusafir

Well-known Member
Joined
Sep 7, 2018
Messages
1,503
Office Version
  1. 2021
Platform
  1. Windows
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

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
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,224,521
Messages
6,179,289
Members
452,902
Latest member
Knuddeluff

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