View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Gerardo Gerardo is offline
external usenet poster
 
Posts: 27
Default 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