From 2007 to 2003 : Changing data source in Pivot Tables in macro

ljubinville

New Member
Joined
Jan 30, 2008
Messages
3
Hello,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
<o:p> </o:p>
Situation : I have an exel worksheet wich contains 2 sheets. The first is the data and second contains 4 pivot tables. It also contains a macro that will update the Data source of all 4 pivot tables since the data changes over time. The macro was designed in Excel 2007 and works perfectly, but would not work in Excel 2003 (the data source starts at A2 and contains only 1 line).<o:p></o:p>
<o:p> </o:p>
Here is the macro code :<o:p></o:p>
<o:p> </o:p>
ActiveSheet.PivotTables("Pivot table 1").ChangePivotCache _<o:p></o:p>
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _<o:p></o:p>
Path & "[" & File & "]" & DataSheet & "!R1C1:R" & EndLine & "C" & EndColomn _<o:p></o:p>
, Version:=xlPivotTableVersion10)<o:p></o:p>
<o:p> </o:p>
How would you design this to work in Office 2003 ?<o:p></o:p>
:confused:
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Can I ask why you are using a macro to change the source over time? If you create a defined name that calculates the data range, and reference that as the PivotTable source, everything would work automatically without the need to run a macro to redefine the source data.
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top