Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default 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
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
Problem inserting calculated pivot fields into Pivot Table (2007) wamiller36 Excel Discussion (Misc queries) 1 March 5th 10 11:40 PM
Defining a table edwino2007 New Users to Excel 5 November 9th 08 08:21 AM
Pivot Table in Excel 2007 : Problem with % in Table spudsnruf Excel Discussion (Misc queries) 2 January 9th 08 09:53 PM
Defining fiscal month for pivot table Paul Excel Discussion (Misc queries) 1 February 16th 07 08:35 PM
Syntax problem in defining OnAction macro definition held in Add-in! Charles Jordan Excel Programming 4 March 5th 05 06:35 AM


All times are GMT +1. The time now is 03:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"