LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Series Collection Name Problem

I'm really hoping someone can help me here, because this is driving me
round the bend. I've got a subroutine which I call to create a chart.
Basically the code it is called from is in a loop, each time I go round
the loop the task number increments and I create a new chart for the
task.

This works the first two times and I have perfect charts for task 1 and
for task 2, but everytime task 3 falls over, with the error message
that the name cannot be set for the series collection, the series
collection is 3. There is no other collection with same name and no
other task with the same name, so I can't see what would be the clash,
the worksheets are all based on templates and are all the same, I've
tried them with different data in them and with the same data in them,
nothing seems to make a difference.

Please can anyone help I have run out of why this could be???

I've inserted the code below:


Public Sub Create_Charts()
'This function creates an EV chart for the current task

Sheets(task_sheet_name & task).Select
'could be any range, but for some reason works best if it is a blank
cell
'do need to have it?
Range("A3").Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets(task_sheet_name &
task).Range("A3")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection.NewSeries

ActiveChart.SeriesCollection(1).XValues = Worksheets(task_sheet_name &
task).Range(o_Date_Col & o_Start_Row & ":" & o_Date_Col & end_task_row)
ActiveChart.SeriesCollection(1).Values = Worksheets(task_sheet_name &
task).Range(o_Planned_EV_Col & o_Start_Row & ":" & o_Planned_EV_Col &
end_task_row)
ActiveChart.SeriesCollection(1).Name = Worksheets(task_sheet_name &
task).Range(o_Planned_EV_Col & o_Start_Row - 1)

ActiveChart.SeriesCollection(2).XValues = Worksheets(task_sheet_name &
task).Range(o_Date_Col & o_Start_Row & ":" & o_Date_Col & end_task_row)
ActiveChart.SeriesCollection(2).Values = Worksheets(task_sheet_name &
task).Range(o_Outlook_EV_Col & o_Start_Row & ":" & o_Outlook_EV_Col &
end_task_row)
ActiveChart.SeriesCollection(2).Name = Worksheets(task_sheet_name &
task).Range(o_Outlook_EV_Col & o_Start_Row - 1)

ActiveChart.SeriesCollection(3).XValues = Worksheets(task_sheet_name &
task).Range(o_Date_Col & o_Start_Row & ":" & o_Date_Col & end_task_row)
ActiveChart.SeriesCollection(3).Values = Worksheets(task_sheet_name &
task).Range(o_Actual_EV_Col & o_Start_Row & ":" & o_Actual_EV_Col &
end_task_row)
ActiveChart.SeriesCollection(3).Name = Worksheets(task_sheet_name &
task).Range(o_Actual_EV_Col & o_Start_Row - 1)

ActiveChart.Location Whe=xlLocationAsNewSheet, Name:=task_chart_name
& task
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = chart_title
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text =
chart_x_legend
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text =
chart_y_legend
End With
Sheets(task_sheet_name & task).Select
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
series objects; finding specific ones in the collection cate Charts and Charting in Excel 2 April 4th 10 03:25 PM
Series collection pb on Ecxel 2003 chart David Excel Programming 2 November 15th 06 05:19 PM
How to store the lengthy value in Series collection? ramkumar_cpt Charts and Charting in Excel 1 December 16th 05 01:16 PM
Changing source for series collection in charts JbL Excel Programming 1 October 12th 04 10:56 PM
Series Collection Points Bill[_28_] Excel Programming 12 September 29th 04 04:21 PM


All times are GMT +1. The time now is 06:54 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"