LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro to update pivot table data range

Hi all,
I am trying to create Macro in excel 2010 which will change the data range for a pivot table if have added extra datainto the source data worksheet. This is the macro belowbut it returns a runtime error 5 "Invalid procedure Call) error:

Sub ChangePivotTableDataRange()

ActiveSheet.PivotTables("PivotTable1").ChangePivot Cache ActiveWorkbook. _
PivotCaches.Create(SourceType:=xlDatabase, SourceData:=Worksheets("Sales").Range("A5").Curren tRegion.Address _
, Version:=xlPivotTableVersion14)

End Sub

Any help on this would be greatly appreciated.

Taffy
 
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
update pivot table data range JN[_2_] Charts and Charting in Excel 2 September 29th 08 08:40 PM
Auto Update Range of a Pivot Table TJDeborah[_2_] Excel Programming 1 April 19th 06 01:31 PM
How do I set the pivot table to auto-update the data range? Toni @ Fidelity Excel Discussion (Misc queries) 3 March 17th 06 09:45 PM
Macro to update pivot table data range Mike_M Excel Programming 2 May 25th 05 04:02 PM
Update Data Field in Pivot Table with Dynamic Excel Range ExcelMonkey[_97_] Excel Programming 1 March 3rd 04 08:16 PM


All times are GMT +1. The time now is 06:27 AM.

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"