What are the keywords XValues and YValues? Are they range variables?
Strings? Should they be in quotes? Wherever you have range, you should
precede it with a reference to the worksheet. Something like this:
Dim sht As Worksheet
Dim myChart As ChartObject
Set sht = ActiveSheet
Set myChart = sht.ChartObjects.Add(... etc...)
' if YValues is a string containing a range
myChart.Chart.Values = sht.Range(YValues)
' if YValues is the name of a range defined on the sheet
myChart.Chart.Values = sht.Range("YValues")
' if YValues is a range
myChart.Chart.Values = YValues
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -
http://PeltierTech.com
_______
wrote in message
ups.com...
I added .chart to the lines
myChart.Chart.ChartType = xlXYScatterLines
myChart.Chart.SeriesCollection.NewSeries
myChart.Chart.Values = Range(YValues)
myChart.Chart.XValues = Range(XValues)
myChart.Chart.name = Application.VLookup(i, Range("Graph"), 2,
False)
so now i get to the values line and it gives me error there. error is
range of method global failed.
this is how my YValues is defined.
yvalues is a string
YValues = Cells(49 + i, 3) & "Yvalue"
that gives it the name of the dynamic range
when i=0 yvalues = "Feed_Yvalue"
and the Feed_Yvalue range is defined as = OFFSET(Feed!$AP$5,scrollval,
0,zoomval,1)
im creating a chart that where there is a pulldown menu on the left
where they select what they are graphing from the worksheet. the
celllinked from the combobox sets the offset in the worksheet where
the data is stored so that the last column =the column selected in the
box. the dynamic range just links to that last column.
this graph is to have both zooming and scrolling abilities. I change
the max for the scroll and zoom bar by linking the index of how many
rows of data there are to a variable and set that variable as the max.
so far everything works i have the scroll bars and zooom which their
maximum changes based on the index and the combobox works and sets the
right offset. i am just having trouble creating the graph. hope you
can help.
if theres anything else i can do to help you understand let me know.
thanks very much.
sammy