Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change pivot table source data via macro
I would like to write a macro to change the source data of a pivot
table. I have all of the other code written, I just cannot figure out what code I need to get the current pivot table's data source or how to define a new data source. Any help would be much appreciated. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Change pivot table source data via macro
Try downloading the PivotPlay add-in from Debra Dalgleish's website:
http://www.contextures.com/xlPivotPlay01.html The vba code in PivotPlay is unprotected. Post back with questions. Does that help? *********** Regards, Ron XL2002, WinXP "Tim879" wrote: I would like to write a macro to change the source data of a pivot table. I have all of the other code written, I just cannot figure out what code I need to get the current pivot table's data source or how to define a new data source. Any help would be much appreciated. |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change data source of pivot table | Excel Discussion (Misc queries) | |||
change the ODBC data source of a pivot table | Excel Discussion (Misc queries) | |||
Q: Change pivot table source path? | Excel Discussion (Misc queries) | |||
Pivot Table external XLS file source change and GETPIVOTDATA refresh | Excel Discussion (Misc queries) | |||
Pivot Table data source "data source contains no visible tables" | Excel Worksheet Functions |