ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning array values to seriescollection (https://www.excelbanter.com/excel-programming/407528-assigning-array-values-seriescollection.html)

Gerardo

Assigning array values to seriescollection
 
Hello,

I tried to add a series to a graph and it worked ok as long as the selected
range to build the array has less than 13 values.

What I do is get a range from user input. Then assign it to a range
variable. I create an array and start adding elements to keep the cummulative
from the given data. Then assigning this array to display as a cummulative
series and plot it with the original range.

What can I do to make it work after the 13th data input?

Set RngMensual = Application.InputBox("My prompt", "My Title", Type:=8)

For Each RngCelda In RngMensual
SngTotal = RngCelda.Value + SngTotal
ReDim Preserve SngAnual(i)
SngAnual(i) = SngTotal
i = i + 1
Next RngCelda

Charts.Add
With ActiveChart
.ChartType = xlLineMarkers
.SeriesCollection.NewSeries
'.SeriesCollection(1).Values = SngAnual
.SetSourceData Source:=RngAnual
.SeriesCollection(1).Select
With Selection.Border
.ColorIndex = 11
.Weight = xlMedium
.LineStyle = xlContinuous
End With


All times are GMT +1. The time now is 01:15 AM.

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