Variable Series in graphs

J

jersiq

I have a problem with adding series to a newly created graph in VBA
The ranges for my data need to be pulled from a variable amount of
sheets, based upon the data I am currently working with.

The array to obtain the variable values is in an array of integers
which may not be necessarily sequential.

i.e on one book I may have the integers of 1, 2, 3, 4
on another I may have 1, 2, 3, 9, 10

I am able to create the series, and chart without any problems,
however when I run my macro it gives an error of "series formula is
too long"
I checked the help, but I am not quite sure where I am going wrong
here.
below is my code, the parts that are only pertinent to making the
charts.

Set alpha_chartobj = Sheets("Alpha Face").ChartObjects.Add _
(250, 375, 75, 225)

With alpha_chartobj.Chart
.ChartType = xlLine

For Each carrier_graph In Sheets("Sheet1").Range("D2:D" &
carrier_array_upper)
With .SeriesCollection.NewSeries
.Values = Sheets("F" & carrier_graph).Range("B2:B" &
last_row_filtered)
.Name = "F" & carrier_graph
End With
Next
End With
 
J

jersiq

I have a problem with adding series to a newly created graph in VBA
The ranges for my data need to be pulled from a variable amount of
sheets, based upon the data I am currently working with.

The array to obtain the variable values is in an array of integers
which may not be necessarily sequential.

i.e on one book I may have the integers of 1, 2, 3, 4
on another I may have 1, 2, 3, 9, 10

I am able to create the series, and chart without any problems,
however when I run my macro it gives an error of "series formula is
too long"
I checked the help, but I am not quite sure where I am going wrong
here.
below is my code, the parts that are only pertinent to making the
charts.

Set alpha_chartobj = Sheets("Alpha Face").ChartObjects.Add _
(250, 375, 75, 225)

With alpha_chartobj.Chart
.ChartType = xlLine

For Each carrier_graph In Sheets("Sheet1").Range("D2:D" &
carrier_array_upper)
With .SeriesCollection.NewSeries
.Values = Sheets("F" & carrier_graph).Range("B2:B" &
last_row_filtered)
.Name = "F" & carrier_graph
End With
Next
End With

Sorry I forgot to mention the error "Series Formula is too long"
occurs on the line:

Set alpha_chartobj = Sheets("Alpha Face").ChartObjects.Add _
(250, 375, 75, 225)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top