Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Changing Pivot Table Source Data

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Changing Pivot Table Source Data

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing Pivot Table Data Source to multiple ranges Tom Garner Charts and Charting in Excel 1 December 24th 09 12:14 AM
How to refresh a pivot table that uses changing source data Mike C[_5_] Excel Programming 1 February 13th 08 01:54 AM
Changing Pivot Table source jerredjohnson Excel Discussion (Misc queries) 1 May 4th 06 06:59 AM
Changing Data Source for Pivot Table jjj Excel Discussion (Misc queries) 1 April 13th 06 09:36 AM
Changing data source in pivot table- "Back" button is disable Ashok Excel Discussion (Misc queries) 0 November 8th 05 02:06 PM


All times are GMT +1. The time now is 04:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"