Reputation: 1
I'm total new with Excel-VBA and I'm here to ask your help! I have a workbook in Excel 2003 where there's a pivot table in the sheet "PivotTableSheet" from which I have created an embedded Pivot chart in sheet "ChartSheet" using this code:
Sub CreateChartForPivot()
Charts.Add
ActiveChart.ChartType = xlColumnStacked
ActiveChart.SetSourceData Source:=Sheets("PivotTableSheet").Range("B5:B8"), PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="ChartSheet"
ActiveChart.Legend.Delete
End Sub
The result works pretty fine, but I'd like to remove the labels "Drop Page Fields Here" and "Drop Series Fields Here" at the top and the right of the chart. They are just awful ;-)
Can anyone help me doing that in VBA?
Thanks a lot!!!
Upvotes: 0
Views: 2010
Reputation: 23
You can try
Sheets("PivotTableSheet").ShowDrillIndicators = False
or
Sheets("PivotTableSheet").DisplayFieldCaptions = False
Upvotes: 0
Reputation: 149305
The only way to remove the labels is to do the below but then it will hide the rest of the buttons as well.
With the pivot chart selected, on the pivot toolbar, choose PivotChart>Hide PivotChart Field buttons.
If you want a VBA code, You can record a macro for that :)
Upvotes: 2