Try this:
With Worksheets("2.1 - Surface - Solution")
.Values = .Range(.Range("E5"), .Range("E5").Offset(0, end_21.Value))
.Values = .Range(.Range("B5"), .Range("B5").Offset(0, end_21.Value))
End With
If the series is an XY or Line series, and there is not plottable data in
the series before the code is run, it will give an error anyway. If that
occurs, try changing the series temporarily to an area or column type prior
to changing the data.
- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. -
http://PeltierTech.com
_______
"baconcow" wrote in message
...
I am trying to modify the following code from...
' .Values = "='2.1 - Surface - Solution'!$E$5:$E$12"
' .XValues = "='2.1 - Surface - Solution'!$B$5:$B$12"
To...
.Values = Worksheets("2.1 - Surface - Solution").Range("E5",
Range("E5").Offset(0, end_21.Value))
.XValues = Worksheets("2.1 - Surface - Solution").Range("E5",
Range("E5").Offset(0, end_21.Value))
Where (these are the first things):
Dim end_21 as Range
Set end_21 = Worksheets("2.1 - Surface - Solution").Range("M1")
... and range M1 has a value of 8 in it
It gives me a application or object-defined error. I am not sure how to
modify the .Values and .XValues.
Thanks