PC Review


Reply
Thread Tools Rate Thread

Changing Pivot Table Source Data

 
 
Barb Reinhardt
Guest
Posts: n/a
 
      14th Apr 2009
I'm trying to change the source data for a pivot table and am using this syntax

myPivot.SourceData = myString

where

mystring = 'ALL ITEMS'!all_items

I'm getting a run time error 1004, reference is not valid.

I'm not sure what the problem might be. Can someone assist?

Thanks,
Barb Reinhardt
 
Reply With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      15th Apr 2009
this works for me...

Sub set_two()
Dim pc As PivotCache
Dim pt As PivotTable
Set pt = Sheet1.PivotTables(1)
With pt
.SourceData = "'ALL ITEMS'!all_items"
.RefreshTable
End With
End Sub

i was able to raise error 1004 by using a range name that didn't exist - ie
mis-typing the name

Patrick Moloy

"Barb Reinhardt" wrote:

> I'm trying to change the source data for a pivot table and am using this syntax
>
> myPivot.SourceData = myString
>
> where
>
> mystring = 'ALL ITEMS'!all_items
>
> I'm getting a run time error 1004, reference is not valid.
>
> I'm not sure what the problem might be. Can someone assist?
>
> Thanks,
> Barb Reinhardt

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Pivot Table Data Source to multiple ranges Tom Garner Microsoft Excel Charting 1 24th Dec 2009 12:14 AM
How to refresh a pivot table that uses changing source data Mike C Microsoft Excel Programming 1 13th Feb 2008 01:54 AM
Problem Changing Data Source In Pivot Table SHMUNCY Microsoft Excel Discussion 0 12th Jun 2006 09:09 PM
Changing Data Source for Pivot Table jjj Microsoft Excel Misc 1 13th Apr 2006 09:36 AM
Pivot table: Changing location of Excel data source? Toby Erkson Microsoft Excel Discussion 4 4th Oct 2004 09:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:09 AM.