×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Changing source of all pivot tables in a workbook

Changing source of all pivot tables in a workbook

Changing source of all pivot tables in a workbook

(OP)
Hi All

For the past few months I have been building a dashboard at work using excel. Until now the dashboard consisted of a couple of sheets of graphs/charts etc which were based on pivot tables within the workbook. The underlying data was also on the workbook. All was working fine until I began to expand the functionality of the dashboard and I started getting errors staying that excel didn't have enough resources etc. I have now had to go back to the drawing board. It appears that the only way to stop the resource errors is to remove the worksheets containing the underlying data into a new linked workbook (I suspect the errors were because the data was getting deleted and reentered weekly). Once ive removed the worksheets containing the data, is there an easy way to update all the pivot tables in the dashboard to use the new location of the underlying data rather than the old location.

RE: Changing source of all pivot tables in a workbook

Loop through the PivotCaches collection and change the SourceData for each appropriately, e.g.:

CODE

Dim myCache As PivotCache
For Each myCache In ActiveWorkbook.PivotCaches
    myCache.SourceData = "Sheet1!R1C1:R4C1"
    myCache.Refresh
Next 

RE: Changing source of all pivot tables in a workbook

Quote:


I suspect the errors were because the data was getting deleted and reentered weekly

Try making the source data table a Structured Table. A Structured Table has a Name and has Named Ranges. If your PTs reference the ST Name doesn't matter that data is deleted and reentered.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Changing source of all pivot tables in a workbook

>Once ive removed the worksheets

Skip, I'd presume that removing the worksheets would remove the structured tables ...

RE: Changing source of all pivot tables in a workbook

I was surmising that it might not be necessary to remove the source data tables if they were STs.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Changing source of all pivot tables in a workbook

(OP)
Skipvought

My data is already in a table

RE: Changing source of all pivot tables in a workbook

A Structured Table?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

RE: Changing source of all pivot tables in a workbook

(OP)
Yes

RE: Changing source of all pivot tables in a workbook

Okay. Surprising.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close