A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problem with .Values



 
 
Thread Tools Display Modes
  #1  
Old October 22nd, 2003, 12:42 PM
garnote
external usenet poster
 
Posts: n/a
Default Problem with .Values

Hi all,

I have a Sub for construct graphic but
if the number of vx is too large, ERROR
at .Values = Y. Why ?

Thank you for your help,

Serge

Sub ConstruireGraphiqueParTableauxVBA()
Dim X() As Double
Dim Y() As Double, i As Long, vx As Double
ReDim X(i), Y(i)
Application.ScreenUpdating = False
ici = ActiveSheet.Name
'*********************************************
For vx = -15 To 15
'If the number of vx is too large, ERROR
'at .Values = Y. Why ?
'*********************************************
X(i) = vx
Y(i) = vx ^ 2
i = i + 1
ReDim Preserve X(i), Y(i)
Next vx
Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.Location Whe=xlLocationAsObject, Name:=ici
End With
Set ns = ActiveChart.SeriesCollection.NewSeries
With ns
.XValues = X
.Values = Y
End With
Application.ScreenUpdating = True
End Sub


  #2  
Old October 24th, 2003, 05:11 PM
Jon Peltier
external usenet poster
 
Posts: n/a
Default Problem with .Values

Allo Serge -

You can assign an array to .Values (or .XValues), but eventually Excel
converts it into a string literal in the series formula. There's a
limit of around 255 characters (a little shorter, maybe 248 to 252, I
used to know) for each part of the series formula.

You have a few choices. Easiest is to dump the array into a worksheet
range, and plot the worksheet range. Another option is to build your
own literal array, limiting the significant digits in your values, as I
describe near the bottom of this page:

http://www.geocities.com/jonpeltier/...ChartData.html

Finally, you could put the array into a defined name in the worksheet,
and chart the name. You're still linked to the workbook, but not to a
particular worksheet range.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
http://www.geocities.com/jonpeltier/Excel/index.html
_______

garnote wrote:

Hi all,

I have a Sub for construct graphic but
if the number of vx is too large, ERROR
at .Values = Y. Why ?

Thank you for your help,

Serge

Sub ConstruireGraphiqueParTableauxVBA()
Dim X() As Double
Dim Y() As Double, i As Long, vx As Double
ReDim X(i), Y(i)
Application.ScreenUpdating = False
ici = ActiveSheet.Name
'*********************************************
For vx = -15 To 15
'If the number of vx is too large, ERROR
'at .Values = Y. Why ?
'*********************************************
X(i) = vx
Y(i) = vx ^ 2
i = i + 1
ReDim Preserve X(i), Y(i)
Next vx
Charts.Add
With ActiveChart
.ChartType = xlXYScatter
.Location Whe=xlLocationAsObject, Name:=ici
End With
Set ns = ActiveChart.SeriesCollection.NewSeries
With ns
.XValues = X
.Values = Y
End With
Application.ScreenUpdating = True
End Sub



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 07:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.