ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Remove specific Pivotcache fields (https://www.excelbanter.com/excel-discussion-misc-queries/109665-remove-specific-pivotcache-fields.html)

Dan Bayliss

Remove specific Pivotcache fields
 
Hello all

I'm attempting to have VBA code to remove specific Pivotcache fields

basically currently i have the following

Name | Sales
Bob | 5
Dave | 3

Now the name field shows even if blank, so if i clear the sales data
and refresh i still see the list of names

What i ideally want todo is to clear just the number of sales, so each
time the sheet is opened it has blank number of sales

Any ideas/suggestions would be really appreciated!

I tried the following with no luck
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
For Each pf In pt.VisibleFields
For Each pi In pf.PivotItems
If pi = "Sales" Then
pi.Delete
End If
Next
Next
Next
Next



All times are GMT +1. The time now is 12:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com