Pivot Table Criteria Missing Data
On 27 Oct, 19:40, MSweetG222
wrote:
Chris,
Try clearing and refreshing the pivot table cache.
Worksheets("Sheet4").PivotTables("PivotTable1").Pi votCache.MissingItemsLimi*t
= xlMissingItemsNone
Worksheets("Sheet4").PivotTables("PivotTable1").Pi votCache.Refresh
Worksheets("Sheet4").PivotTables("PivotTable1").Pi votCache.MissingItemsLimi*t
= xlMissingItemsDefault
Worksheets("Sheet4").PivotTables("PivotTable1").Pi votCache.Refresh
Hope that works for you.
MSweetG222
--
Thx
MSweetG222
" wrote:
Hi,
I wonder if anyone has had similar problems.... I have created an
automated Management Reporting Dashboard. *Data is being imported from
external sources, which are pivoted using static pivot tables and
dynamic named ranges.
In general it all works fine, except that from time to time the pivot
criteria drop downs dont show the correct data to choose from. *The
code, when importing the data, cycles round all pivot tables and
refreshes. *Also when you clear the spreadsheet of old data the code
turns of the saving of data within the Pivot table so its all clear.
No matter what I do, the only way for the pivot to refresh itself
properley and show the correct data within the drop downs is to delete
and recreate the pivot.
Any thoughts would be much appreciated.
Chris.- Hide quoted text -
- Show quoted text -
Thanks MSweetG222, but no luck I'm afraid. This is similar to code
I'm already using, although I hadnt considered the second cache
refresh. Still, your code works and does the refresh but still, when
I click on the drop down the data is incorrect, yet if I move that
criteria drop down out of the pivot criteria area, refresh the pivot
table, and put it back in everything is ok. Its driving me mad!!!
I recorded the macro to do that automatically. It produced the
following code..
ActiveSheet.PivotTables("EnqOrderPeriod").PivotFie lds("Exec
Location").Orientation = xlHidden
ActiveSheet.PivotTables("EnqOrderPeriod").PivotCac he.Refresh
With ActiveSheet.PivotTables("EnqOrderPeriod").PivotFie lds("Exec
Location")
.Orientation = xlPageField
.Position = 3
End With
This, when run, fixes the problem .....but...
I'd like to loop around all the 13 or so pivot tables in the workbook
and run some code against them to make sure this problem is resolved
automatically (as the end users are not going to be able to understand
if there is a problem) and unless I manually specify every single
pivot field within the Page Field (criteria) it is not going to work.
Thanks for your help, its much appreciated.
Chris.
|