chart series: displaying the source range
Thank you for your help.
"smartin" wrote:
R Vaughn wrote:
I am trying to set up a message box that will display the source range for a
series in a line graph. I get a "Run-time error 438" with the following
code. What is wrong?
ChartObjects(1).Select
x = ChartObjects(1).SeriesCollection(5).Values
MsgBox (x)
This will display the value portion of the series:
Sub Lime()
Dim co As ChartObject
Dim sc As SeriesCollection
Set co = ActiveSheet.ChartObjects(1)
Set sc = co.Chart.SeriesCollection
Debug.Print sc(5).Formula
' the series' value range is:
MsgBox Split(sc(5).Formula, ",")(2)
Stop
End Sub
FYI The Values property is an array, so you can't display it as a string
without some treatment.
Formula is a string, but I treat it like a comma-delimited array (see
the output in the debug window). The "value" portion of the Formula
"array" is member 2 because Split returns a zero-based array.
.
|