Pivot Table Calculated Datafield Caption Problem

G

Guest

Hello, I'm having a problem with Excel forcing "Sum of " in front of the
Caption I'm assigning to my Datafields in a Pivot Table. Please see code
below. In this case Excel takes my Caption "Backlog Coverage, Rev (K$)" and
turns it into "Sum of Backlog Coverage, Rev (K$)" on the report. On the
report I don't want the users to see that "Sum of ." Thanks in advance for
any help you can provide.
Best Regards,
Dean

CODE EXCERPT

Set ptDashPORTPivot = Worksheets("DashPORT").PivotTables("DashPORTPivot")

strDatafieldCaption = "Backlog Coverage, Rev (K$)"
strDatafieldFormula = "(BillGrossR + BLCSDR)/1000"
strNumberFormat = "#,###;-#,###;"

ptDashPORTPivot.CalculatedFields.Add strDatafieldCaption,
strDatafieldFormula, True

With ptDashPORTPivot.PivotFields(strDatafieldCaption)
.Orientation = xlDataField
.NumberFormat = strNumberFormat
End With
 
D

Debra Dalgleish

You can add a space to the end of the caption:

With ptDashPORTPivot.PivotFields(strDatafieldCaption)
.Orientation = xlDataField
.NumberFormat = strNumberFormat
.Caption = strDatafieldCaption & " "
End With
 
G

Guest

Hi Debra,
It worked, THANKS! I decided to append something to the end of the Datafield
name string instead because that's hidden to the user. Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top