ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable Series in graphs (https://www.excelbanter.com/excel-programming/402896-variable-series-graphs.html)

[email protected]

Variable Series in graphs
 
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


[email protected]

Variable Series in graphs
 
On Dec 17, 5:15 pm, wrote:
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)


All times are GMT +1. The time now is 02:06 PM.

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