Pivot dropdowns do not refresh when all data is replaced

dhasler

New Member
Joined
Jan 21, 2004
Messages
5
Hello,

I have a spreadsheet containing over 20 pivot tables. I would like to replace the entire data set with all new data in exactly the same format with the same column names. When I do this and refresh my tables, the data fields in my pivot tables calculate correctly but the names in the drop down pivot table menus contain the data names from both the old and new data sets. Is there a way to see only the new data names?

Thank you in advance for your help!
 

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

GorD

Well-known Member
Joined
Jan 17, 2004
Messages
1,446
The esiest way to clear out the old data is via, macro.

Heres the macro for excel 2002 onwards - not written by me I might add.

There is a d ifferent version for pre excel 2002

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
 

Watch MrExcel Video

Forum statistics

Threads
1,118,228
Messages
5,571,012
Members
412,353
Latest member
SofiaV
Top