View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Erin[_5_] Erin[_5_] is offline
external usenet poster
 
Posts: 19
Default 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?