ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pivot Tables (https://www.excelbanter.com/excel-programming/390802-pivot-tables.html)

Steve

Pivot Tables
 
I have dynamic data that is summarized in Pivot Tables. Once refreshed the
old data is still in the dropdowns but not actually still in the data. Is
there a way to purge non-existant data from the dropdowns?
Thanks
Steve

klysell

Pivot Tables
 
Hi Steve,

You probably already have this one answered, but I found some code on a
website referenced from this DG that does the trick. It was found on the
following site: http://www.contextures.com/xlPivot04.html

Here it is:

Sub DeleteMissingItems2002All()
'prevents unused items in non-OLAP PivotTables

'in Excel 2002 and later versions
'If unused items already exist,
'run this macro then refresh the table
Dim pt As PivotTable
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
pt.PivotCache.Refresh
Next pt
Next ws

End Sub

Just integrate it into your code and it works beautifully!
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.943.9098


"Steve" wrote:

I have dynamic data that is summarized in Pivot Tables. Once refreshed the
old data is still in the dropdowns but not actually still in the data. Is
there a way to purge non-existant data from the dropdowns?
Thanks
Steve


Steve

Pivot Tables
 
Thanks Kent. Works great

"klysell" wrote:

Hi Steve,

You probably already have this one answered, but I found some code on a
website referenced from this DG that does the trick. It was found on the
following site: http://www.contextures.com/xlPivot04.html

Here it is:

Sub DeleteMissingItems2002All()
'prevents unused items in non-OLAP PivotTables

'in Excel 2002 and later versions
'If unused items already exist,
'run this macro then refresh the table
Dim pt As PivotTable
Dim ws As Worksheet

For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
pt.PivotCache.Refresh
Next pt
Next ws

End Sub

Just integrate it into your code and it works beautifully!
--
Kent Lysell
Financial Consultant
Ottawa, Ontario
W: 613.943.9098


"Steve" wrote:

I have dynamic data that is summarized in Pivot Tables. Once refreshed the
old data is still in the dropdowns but not actually still in the data. Is
there a way to purge non-existant data from the dropdowns?
Thanks
Steve



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

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