JustAnswer > Programming
Ask A Question|Register|Login|Help
JustAnswer

Programming

Ask a Programming Question, Get an Answer ASAP!

Have your own Programming question?

2 Programmers are Online Now
characters left:
Not a Programming Question?
Bookmark and Share

Question

I have developed a spreadsheet that has 1 page with all the data. There are approximately 20 pivot tables showing different information from the page. The data area has been named Info, so all the pivot tables refer to the area named info.

My problem is, every time the client copies new data onto this sheet and the area is renamed, the data is totally different from the previous data. There is a button that the client clicks to refresh all the pivot tables. But the pivot tables keep the previous headings in the lists, so the lists are just getting longer and longer, it does not get rid of the headings that no longer exist in the Info.

What can I do to rectify this problem? Please help, as the Pivot tables are getting out of hand and then errors start appearing that the pivot table cannot overlap.

Thank you so much for your help
Alta Niemandt
South Africa

Submitted: 97 days and 13 hours ago.
Category: Programming
Value: $18
Status: AWAITING CUSTOMER ACTION
+
Read More

Optional Information

Computer OS: Windows XP
Browser: IE

Already Tried:
I am using Excel XP and this is the code to refresh the tables:
    Dim pt As PivotTable
    
    Sheets("Pivots").Select

    For Each pt In ActiveSheet.PivotTables
       
        pt.RefreshTable

    Next pt

Answer

I don't have your exact version of Excel XP to test this with,
but you can use the following code to reset your pivot tables
and clear the pivot table cache, before running your code
to refresh your pivot tables. Please let me know if this
works for you or if you have any questions.


'prevents unused items in non-OLAP PivotTables

Dim pt As PivotTable
Dim ws As Worksheet
Dim pc As PivotCache

'change the settings
For Each ws In ActiveWorkbook.Worksheets
For Each pt In ws.PivotTables
pt.PivotCache.MissingItemsLimit = xlMissingItemsNone
Next pt
Next ws

'refresh all the pivot caches
For Each pc In ActiveWorkbook.PivotCaches
On Error Resume Next
pc.Refresh
Next pc



Picture
Expert: Cherryl Lewis
Pos. Feedback: 100.0 %
Accepts: 
Answered: 8/17/2009

Computer Software Engineer

MCSD * C# VB C++ .NET * Excel * MS Access * SQL Server * Oracle * Java * Python * Pascal

+
Read More

Related Programming Questions

  • Hi Jerry, you helped me (Japie1973) successfully to create
  • how to get data from one cell into multiple columns so that
  • I have this question that I was trying to figure out and don...
  • we have cadvance system and we had to reload the product sym...
  • I am willing to pay $40 for this, I was going to do $10 and
  • how can I maintain focus within a textbox while validating
  • Using the Internet and other resources, explain modularizati...
  • Is there a find/replace function to use on multiple folders



Disclaimer: Information in questions, answers, and other posts on this site ("Posts") comes from individual users, not JustAnswer; JustAnswer is not responsible for Posts. Posts are for general information, are not intended to substitute for informed professional advice (medical, legal, veterinary, financial, etc.), or to establish a professional-client relationship. The site and services are provided "as is" with no warranty or representations by JustAnswer regarding the qualifications of Experts. To see what credentials have been verified by a third-party service, please click on the "Verified" symbol in some Experts' profiles. JustAnswer is not intended or designed for EMERGENCY questions which should be directed immediately by telephone or in-person to qualified professionals.
Question List | Become an Expert | Terms of Service | Security & Privacy | About Us
© 2003-2009 JustAnswer Corp.