Pie charts in Macros

I

Ian M

I have recorded a macro in Excel whereby I create a pie chart using
the Chart Wizard.

In Page 3 of the Chart Wizard, I click on the "Data Labels" tab.

Then I check the "Category Name" and "Value" boxes.

However, when I run the macro, the finished chart does not show either
Category Names or Values.

You will see from the code that it doesn't even show up.

Range("A4:B9").Select
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets("Test
Spreadsheet").Range("A4:B9"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsNewSheet,
Name:="Statistics"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = _
"Statistics"
End With
ActiveChart.HasLegend = False

Any ideas?

Kind regards

Ian M
 
Top