ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pie charts in Macros (https://www.excelbanter.com/excel-programming/296021-pie-charts-macros.html)

Ian M

Pie charts in Macros
 
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 Whe=xlLocationAsNewSheet,
Name:="Statistics"
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = _
"Statistics"
End With
ActiveChart.HasLegend = False

Any ideas?

Kind regards

Ian M


All times are GMT +1. The time now is 04:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com