See Also: Hide/Show Pivot Table Field Items by Criteria || Excel Pivot Tables || Hide/Show Pivot Table Fields || Refresh Pivot Table via Excel Macros || Excel Subtotals || Making the SUBTOTAL Function Dynamic || Bold Excel Subtotals Automatically || Sum Every Nth Cell || Count of Each Item in a List || Grouping Pivot Tables Problems
Hide/Show Pivot Table Field Items
Those of you that use
will be well aware of their power. Lets look at how we can use Excel VBA to
show or hide Pivot Table Field Items. The Excel macro below should
give you a good idea how this can be done.
Dim pt As PivotTable
Dim pi As PivotItem
Set pt = ActiveSheet.PivotTables("MyPivot")
'Speeds up code dramatically
pt.ManualUpdate = True
For Each pi In pt.PivotFields("Head1").PivotItems
'+0 Forces text number value to real number
Select Case pi.Value + 0
Case 1 To 5
pi.Visible = False
pi.Visible = True
pt.ManualUpdate = False
Excel Dashboard Reports & Excel Dashboard Charts 50% Off Become an ExcelUser Affiliate & Earn Money
Special! Free Choice of Complete Excel Training Course OR Excel Add-ins Collection on all purchases totaling over $64.00. ALL purchases totaling over $150.00 gets you BOTH! Purchases MUST be made via this site. Send payment proof to [email protected] 31 days after purchase date.
Instant Download and Money Back Guarantee on Most Software
Excel Trader Package Technical Analysis in Excel With $139.00 of FREE software!
Microsoft � and Microsoft Excel � are registered trademarks of Microsoft Corporation. OzGrid is in no way associated with Microsoft
Some of our more popular products are below...
Convert Excel Spreadsheets To Webpages | Trading In Excel | Construction Estimators | Finance Templates & Add-ins Bundle | Code-VBA | Smart-VBA | Print-VBA | Excel Data Manipulation & Analysis | Convert MS Office Applications To...... | Analyzer Excel | Downloader Excel | MSSQL Migration Toolkit | Monte Carlo Add-in | Excel Costing Templates