Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default help with Pivot table

I have copied 2 different pivot table macros to adapt to my data. I get the
same error with both.
Here is the code:

worksheets.add
ActivSheet.PivotTableWizard sourcetype:=xldatabase, _
SourceData:=Sheets("Rollup").UsedRange, _
Tabledestination:=ActiveCell, Tablename:= _
"BOEpivot", savedata:=False
With ActiveSheet.PivotTables ("BOEpivot")
.AddFields RowFields:="WBS Desc", _
columnFields:="Events", PageFields:="IPT"
.PivotFields(WBS Desc").Orientation = xlDataField
.PivotFields("Budget").function = xlsum
end with


The error is:

The Pivottable field name is not valid. To create a pivottable report, you
must use data that is organized as a list with labeled columns. If you are
changing the name of a Pivottable field, you must type a new name for the
field.

The field names are exactly as in the source data (of about 30 fields).

This is the first time using Pivot tables and I am confused.

GMet


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default help with Pivot table

this error refers to the source data. One of the columns in your source
data doesn't have a header, has a duplicate header or otherwise has an
invalid field name. I see you are using UserRange to define your data.
That could include blank columns (and/or blank rows). I suspect in this
case it includes blank columns.


Instead of Used Range,
Sheets("Rollup").UsedRange

try:
Sheets("Rollup").Range("A1").CurrentRegion

This assumes that if you selected A1 in Sheet Rollup and did Ctrl+Shift+8
that you would select all your data and nothing extra.

--
Regards,
Tom Ogilvy


"GMet" wrote in message
...
I have copied 2 different pivot table macros to adapt to my data. I get

the
same error with both.
Here is the code:

worksheets.add
ActivSheet.PivotTableWizard sourcetype:=xldatabase, _
SourceData:=Sheets("Rollup").UsedRange, _
Tabledestination:=ActiveCell, Tablename:= _
"BOEpivot", savedata:=False
With ActiveSheet.PivotTables ("BOEpivot")
.AddFields RowFields:="WBS Desc", _
columnFields:="Events", PageFields:="IPT"
.PivotFields(WBS Desc").Orientation = xlDataField
.PivotFields("Budget").function = xlsum
end with


The error is:

The Pivottable field name is not valid. To create a pivottable report,

you
must use data that is organized as a list with labeled columns. If you

are
changing the name of a Pivottable field, you must type a new name for the
field.

The field names are exactly as in the source data (of about 30 fields).

This is the first time using Pivot tables and I am confused.

GMet




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
how to create pivot table from existing pivot table in excel 2007 Udayraj Dhulekar Excel Discussion (Misc queries) 2 July 8th 13 08:22 PM
Pivot Table and Pivot Table dates are not in correct order ls Charts and Charting in Excel 3 July 14th 09 04:02 PM
Filter lines with Pivot table and non Pivot table columns Grover Excel Discussion (Misc queries) 1 September 26th 07 12:48 AM
Filter lines containing pivot table and non pivot table data Grover Excel Worksheet Functions 0 September 24th 07 07:20 PM
Help required with setting up a pivot table with the source on sheet1 to have the pivot table created on sheet called "report" Diana[_5_] Excel Programming 0 August 21st 03 10:19 PM


All times are GMT +1. The time now is 01:54 PM.

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"