Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculated field in pivot tables | Excel Discussion (Misc queries) | |||
pivot tables - insert calculated field | Charts and Charting in Excel | |||
Pivot tables - Insert Calculated field | Excel Discussion (Misc queries) | |||
Calculated field in Pivot Tables | Excel Discussion (Misc queries) | |||
calculated field/item in pivot tables | Excel Discussion (Misc queries) |