Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pivot Table macro translation

Status
Not open for further replies.

glamb

Programmer
Dec 29, 2009
32
0
0
US
So I'm stuck again with this translation:
ActiveSheet.PivotTables("PivotTable1").AddDataField ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("Benefit"), "Sum of Benefit", xlSum

This line goes right after and I have no problem with it,
ActiveSheet.PivotTables("PivotTable1").PivotFields("Sum of Benefit").Caption = _
"Quantity"
But the first one I can't figure out.
Any help is appreciated.
 
AddDataField() is the method, look up it's parameters in the VB help.


1. parameter: ActiveSheet.PivotTables("PivotTable1").PivotFields("Benefit")
2. paraemter: "Sum of Benefit"
3. parameter: xlSum

You should translate ActiveSheet to loExcel.ActiveSheet, or whatever your excel reference variable is called of course.

xlSum is an Excel constant. In the VBA editor (makro editor) you can find out xlSum via MSGBOX(xlSum).

Or you export all excel constants via the 5 steps in faq184-4248 and then lookup what xlSum is.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top