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: 127
Default Pivot Tables calculated field problem from VBA, please I need help

Dear experts,
I am having again a problem with writing a code for a calculated field of a
pivot table.
The calculation of this field is performed with a variable, a string that
should represent the ' Volume (MT) Oct_2004', which is in the code below.
This is because I will change the database every month and there will be a
November, December, etc instead of October.

ActiveSheet.PivotTables("PivotTable1").CalculatedF ields.Add
"Weighted Average PM Deviation (by Volume)", _
"='Deviation * Volume' /' Volume (MT) Oct_2004'", True
ActiveSheet.PivotTables("PivotTable1").PivotFields ("Weighted Average PM
Deviation (by Volume)").Orientation = _
xlDataField

If I now change the code with a test variable
test = " Volume (MT) Oct_2004"
this does not work at all, Excel does not recognize it. (error meassage "an
item name cannot be found", but I am sure the string is correct)

Could you please let me know how to do it? I am getting desperate at it!!

Many thanks in advance.
Best regards,


--
Valeria
 
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
Calculated field in pivot tables nc Excel Discussion (Misc queries) 2 July 24th 08 02:08 PM
pivot tables - insert calculated field Hilda B. Charts and Charting in Excel 0 November 6th 06 08:20 PM
Pivot tables - Insert Calculated field nc Excel Discussion (Misc queries) 0 May 9th 06 09:35 AM
Calculated field in Pivot Tables JILL Excel Discussion (Misc queries) 2 April 28th 06 03:54 PM
calculated field/item in pivot tables Liny Excel Discussion (Misc queries) 1 June 2nd 05 01:00 AM


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