LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 208
Default Change pivot table source data via macro

I wasn't able to find a solution in this code but it is really useful.
Thanks for the tip.

I did find the answer I needed though... the following code worked
For x = 1 To iSheets

'go to a worksheet to change pivot tables
Sheets(x).Activate

'turn warning messages off
Application.DisplayAlerts = False

'change all pivot tables on
'this worksheet one at a time
For Each pt In ActiveSheet.PivotTables
pt.PivotTableWizard SourceType:=xlDatabase, SourceData:= _
strNewPivotTblSrc 'this is defined to be the new
source data for the pivot table
ActiveWorkbook.ShowPivotTableFieldList = False

Next

'turn warning messages on
Application.DisplayAlerts = True
Next

 
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
change data source of pivot table JohnH Excel Discussion (Misc queries) 9 September 15th 06 12:52 AM
change the ODBC data source of a pivot table JohnH Excel Discussion (Misc queries) 0 August 16th 06 07:10 PM
Q: Change pivot table source path? Mark Excel Discussion (Misc queries) 1 July 27th 06 12:40 AM
Pivot Table external XLS file source change and GETPIVOTDATA refresh mbobro Excel Discussion (Misc queries) 0 July 8th 06 12:45 PM
Pivot Table data source "data source contains no visible tables" Jane Excel Worksheet Functions 0 September 29th 05 08:28 PM


All times are GMT +1. The time now is 10:27 PM.

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

About Us

"It's about Microsoft Excel"