Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Found several similar threads but nothing that seems to address thi problem. If I copy an Excel range into a variant, varArray and then use .SeriesCollection.Values = varArray I get Runtime 1004 error "Unable t set the Values property of the Series class". I've tried first copyin the 2D variant into a 1D double or variant to get a 1D array but sam message results. However if I just populate varArray locally with random numbers i works okay. Also I've found that what I originally wanted to do work up to 14 elements in varArray but fails when I increase the size t 15? Examples of what work and what doesn't below - any guidance muc appreciated. (I know I can just use Ranges in the chart but I woul prefer not to have to.) Fails: varT = Range("T").Offset(1, 0).Resize(, 1).Value ReDim dT(1 To 15) ReDim dX(1 To 15) For i = 1 To 15 dT(i) = varT(i, 1) dX(i) = i Next i varT = dT varX = dX Set TheChart = Charts.Add With TheChart .Name = sChart .ChartType = xlXYScatterLines Set TheSeries = .SeriesCollection.NewSeries TheSeries.Values = varT TheSeries.XValues = varX ..... Works: varT = Range("T").Offset(1, 0).Resize(, 1).Value ReDim dT(1 To 14) ReDim dX(1 To 14) For i = 1 To 14 dT(i) = varT(i, 1) dX(i) = i Next i varT = dT varX = dX Set TheChart = Charts.Add With TheChart .Name = sChart .ChartType = xlXYScatterLines Set TheSeries = .SeriesCollection.NewSeries TheSeries.Values = varT TheSeries.XValues = varX ..... Works: ReDim dT(1 To 50) ReDim dX(1 To 50) For i = 1 To 50 dT(i) = CDbl(i/2) dX(i) = i Next i varT = dT varX = dX Set TheChart = Charts.Add With TheChart .Name = sChart .ChartType = xlXYScatterLines Set TheSeries = .SeriesCollection.NewSeries TheSeries.Values = varT TheSeries.XValues = varX .... -- Chris_Hawkin ----------------------------------------------------------------------- Chris_Hawkins's Profile: http://www.excelforum.com/member.php...fo&userid=2692 View this thread: http://www.excelforum.com/showthread.php?threadid=40145 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Charts - Text Box Problem | Charts and Charting in Excel | |||
Problem with SUMPRODUCT and Arrays | Excel Worksheet Functions | |||
Making charts from arrays in VBA | Charts and Charting in Excel | |||
VBA (arrays problem) | Excel Programming | |||
Elusive Problem with Arrays | Excel Programming |