![]() |
Series Category Label in Pie Chart
Brad -
You want the XValues, as in this short macro: Sub MakeAPie() Dim chtOb As ChartObject Set chtOb = ActiveSheet.ChartObjects.Add(100, 100, 250, 175) With chtOb.Chart .ChartType = xlPie .SetSourceData Source:=Sheets("Sheet1").Range("F11") .SeriesCollection.NewSeries .SeriesCollection(1).XValues = ActiveSheet.Range("B9:B11") .SeriesCollection(1).Values = ActiveSheet.Range("C9:C11") .SeriesCollection(1).Name = ActiveSheet.Range("C8") End With End Sub - Jon ------- Jon Peltier, Microsoft Excel MVP http://www.geocities.com/jonpeltier/Excel/index.html _______ Brad wrote: Good morning. I'm interested in changing the series category labels in a chart that I'm creating using VBA. When I generate the chart using the ChartWizard method, my pie chart has a legend that just has the different colored markers, but no labels. And try as I might, I can't figure how to label them. I'd like to label them dynamically using a range of cells, similar to the "Source DataSeries TabCategory Labels:" field when modifying the chart directly. For example: Set cobPie = shtCurrent.ChartObjects.Add(0, 400, 450, 350) cobPie.Chart.ChartWizard rngSource, xlPie, PlotBy:=xlRows, CategoryLabels:=0, _ SeriesLabels:=0, HasLegend:=True, Title:=strName The CategoryLabels parameter only receives an integer datatype..and I can not include the Category Labels in the source of my chart (at least I'd rather not.) Is there anyway to access this property directly? Thanks for the help! -Brad |
All times are GMT +1. The time now is 08:00 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com