Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default chart series: displaying the source range

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)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 915
Default chart series: displaying the source range

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.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default 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.
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get source data range for each series of an active chart Alan[_8_] Excel Programming 0 July 22nd 08 12:15 AM
Displaying series list from each chart sheet in workbook Barb Reinhardt Excel Programming 5 May 31st 06 05:36 PM
Chart -- Source Data... -- Series dialog window Sarah Jane Charts and Charting in Excel 2 January 24th 06 10:27 AM
Array as chart series data source Mitch Excel Programming 1 April 19th 05 10:59 PM
Hiding or Displaying Series In a Chart SPYREN Charts and Charting in Excel 1 November 27th 04 12:49 PM


All times are GMT +1. The time now is 03:58 PM.

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

About Us

"It's about Microsoft Excel"