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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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,223,888
Messages
6,175,208
Members
452,618
Latest member
Tam84

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