Userinput in calculated pivot field

AnnetteTR

Board Regular
Joined
Aug 19, 2010
Messages
85
Hi there<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
I am using a macro to create a pivottable. In that pivottable I will use a calculated field.<o:p></o:p>
The formula for the calculated field goes like this:<o:p></o:p>
Rich (BB code):
Pt.CalculatedFields.Add "UtilityRoomArea", "='AirVolume max' *6/1000", True<o:p></o:p>
Pt.PivotFields("UtilityRoomArea ").Orientation = xlDataField<o:p></o:p>
<o:p></o:p>
Now I want to exchange the value "6" with a user input.<o:p></o:p>
Rich (BB code):
Dim TRfaktor As Integer<o:p></o:p>
TRfaktor = InputBox("How advanced are the units ?")<o:p></o:p>
Pt.CalculatedFields.Add "UtilityRoomArea", "='AirVolume max' *&TRfactor/1000", True<o:p></o:p>
But this syntax gives me the error:<o:p></o:p>
Unable to get the PivotFields property of the PivotTable class!!<o:p></o:p>
<o:p></o:p>
What is the right syntax?

Regards Annette
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,215,848
Messages
6,127,275
Members
449,372
Latest member
charlottedv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top