ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   bar vs. line chart (https://www.excelbanter.com/excel-programming/287728-bar-vs-line-chart.html)

Erin[_5_]

bar vs. line chart
 
I have the following code:

ActiveSheet.ChartObjects("chtLine").Activate
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection(1).Name = Sheets
("Runnability").Range("AllTitle").Value
If Sheets("Runnability").Range("PressTitle").Value
< "" Then
ActiveChart.SeriesCollection(2).Name = Sheets
("Runnability").Range("PressTitle").Value
Else
ActiveChart.SeriesCollection(2).Name = "No data"
End If

The line where it is setting series 2 name to "No data"
fail on a line chart with the following error:

Unable to set the name property of the Series class

This works fine for a Bar chart!!!

The only way I know to fix this is to dynamically destroy
and re-create the data series for the charts. But, I
hate to have to do that. Anyone know another way to work
around the error?


All times are GMT +1. The time now is 11:04 PM.

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