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: 17
Default PivotTableWizard SourceData question

Hi all,

In the VBA online help it says that the SourceData property accepts "an
array of ranges". If this is true, may anyone advise why the following code
failed? Thanks.

Sub CreatePivot()
Dim MonthlyData(1 To 12) As Range
Dim i As Integer

For i = 1 To 12
Set MonthlyData(i) = Worksheets(i).Range("A1").CurrentRegion
Next

ActiveSheet.PivotTableWizard _
SourceType:=xlDatabase, _
SourceData:=MonthlyData, _
tablename:="YearlySales"

End Sub

Frederick Chow
Hong Kong.


 
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
PivotTableWizard help with VB circuit_breaker Excel Worksheet Functions 1 July 7th 09 02:08 PM
Dynamic sourcedata when copying chart within sheet [email protected] Charts and Charting in Excel 3 June 11th 08 03:37 PM
SourceData in pivot table JIM.H.[_2_] Excel Programming 0 June 9th 04 12:59 AM
Change SourceData in Excel PivotTable via VBA CarlsonClan Excel Programming 1 April 9th 04 04:15 AM
Setting up a SourceData:= in VB Emmanuel[_2_] Excel Programming 1 January 22nd 04 08:15 PM


All times are GMT +1. The time now is 01:24 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"