ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding Labels to a XY Chart (https://www.excelbanter.com/excel-programming/414264-adding-labels-xy-chart.html)

Chad[_3_]

Adding Labels to a XY Chart
 
Hi All,

I am trying to write a chunk of code that adds labels to my XY chart.
Basically I code is very simple

ActiveWorkbook.Sheets(pChartSheet).SeriesCollectio n(1).Points(199).DataLabel.Text
= "199"

That line works fine, but

ActiveWorkbook.Sheets(pChartSheet).SeriesCollectio n(1).Points(200).DataLabel.Text
= "200"

fails with the falling error "Runtime Error 1004"

My source data has 215 entries so, 1-199 works fine, but 200 + fails.

Any ideas why?

Thanks
Chad



Chad[_3_]

Adding Labels to a XY Chart
 
I was able to figure it out, but I don't know the reason behind it. In the
data series properties I needed to select 'Show Labels' radio button. It is
strange that it would fail half way through a data series though.

Thanks anyways
Chad




All times are GMT +1. The time now is 07:39 PM.

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