TheRedCardinal
Active Member
- Joined
- Jul 11, 2019
- Messages
- 250
- Office Version
- 365
- 2021
- Platform
- Windows
I have created a sequence in VBA that makes a Pivot Table out of a named data Range - Data.
The data sections work fine, but I need a new field that calculates the Sum of the two data fields.
I tried this:
But when I try to proceed, it gives me an error, highlighting the "Difference" bit and saying Expected: End of Statement.
Have I set the syntax up incorrectly?
The data sections work fine, but I need a new field that calculates the Sum of the two data fields.
I tried this:
Code:
With ActiveSheet.PivotTables("SalesPivotTable").CalculatedFields.Add "Difference", _
"='VAT Value' + Amount", True
But when I try to proceed, it gives me an error, highlighting the "Difference" bit and saying Expected: End of Statement.
Have I set the syntax up incorrectly?