Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Syntax problem defining range for pivot table
I need to create multiple pivot tables from a master spreadsheet containing
income data broken out by business area and customer. I want a separate pivot table for each business area that summarizes the customer data. I have a program that uses an AutoFilter routine to extract subsets of data by business area. These are copy/pasted into new sheets with variable row numbers (starting at cell A1) for each business area. For each of these variable-length sheets I need to create a pivot table using the entire subset of data. My problem: proper syntax for defining the SourceData in the PivotCache €˜Define range variable €˜alldata as all the cells containing data Dim alldata As Range Range("A1").Select Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select Set alldata = ActiveCell €˜Set up cache for pivot table ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatab ase, SourceData: alldata).CreatePivotTable TableDestination:="", TableName:= _ "PivotTable10", DefaultVersion:=xlPivotTableVersion10 The program stops at ActiveWorkbook.PivotCache command. There is something wrong with part- SourceData: = alldata -- Richard |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem inserting calculated pivot fields into Pivot Table (2007) | Excel Discussion (Misc queries) | |||
Defining a table | New Users to Excel | |||
Pivot Table in Excel 2007 : Problem with % in Table | Excel Discussion (Misc queries) | |||
Defining fiscal month for pivot table | Excel Discussion (Misc queries) | |||
Syntax problem in defining OnAction macro definition held in Add-in! | Excel Programming |