Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default SeriesCollection object

Hello. Is there a way to get the name or index of a series collection that
has been clicked?
Something like:
MsgBox ActiveChart.SeriesCollection.Selected.Name
or
MsgBox ActiveChart.SeriesCollection.Selected.Index

Of course, those examples don't work.

Thanks,
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default SeriesCollection object

Is that for a chart-sheet or embedded chart. If the latter, do you want to
trap the selection event of just one chart or all charts on a sheet or all
in a workbook.

Regards,
Peter T


"Mike Archer" wrote in message
...
Hello. Is there a way to get the name or index of a series collection
that
has been clicked?
Something like:
MsgBox ActiveChart.SeriesCollection.Selected.Name
or
MsgBox ActiveChart.SeriesCollection.Selected.Index

Of course, those examples don't work.

Thanks,
Mike



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default SeriesCollection object

The charts are on a worksheet. I would like the event to run when the user
clicks on a series label (like trying to change the text in the label).

--
Thanks,
Mike


"Peter T" wrote:

Is that for a chart-sheet or embedded chart. If the latter, do you want to
trap the selection event of just one chart or all charts on a sheet or all
in a workbook.

Regards,
Peter T


"Mike Archer" wrote in message
...
Hello. Is there a way to get the name or index of a series collection
that
has been clicked?
Something like:
MsgBox ActiveChart.SeriesCollection.Selected.Name
or
MsgBox ActiveChart.SeriesCollection.Selected.Index

Of course, those examples don't work.

Thanks,
Mike




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default SeriesCollection object

You didn't answer the question "If the latter..." but have a go with this -

into a normal module and a class module named as indicated

''' in a normal module
Private colCharts As Collection

Sub StartChartEvents()
Dim i As Long
Dim sht As Object
Dim chtObj As ChartObject
Dim cls As clsChtEvents

Set colCharts = New Collection
For Each sht In ActiveWorkbook.Sheets
For i = 1 To sht.ChartObjects.Count
Set cls = New clsChtEvents
Set cls.cht = sht.ChartObjects(i).Chart
colCharts.Add cls
Next
Next

End Sub

''' in a class named clsChtEvents

Public WithEvents cht As Excel.Chart

Private Sub cht_Select(ByVal ElementID As Long, _
ByVal Arg1 As Long, ByVal Arg2 As Long)
Dim s As String
Dim sr As Series
Select Case ElementID
Case xlSeries
Set sr = cht.SeriesCollection(Arg1)
If Arg2 0 Then s = " Point " & Arg2
MsgBox cht.Parent.Parent.Name & " " & cht.Parent.Name & _
vbCr & sr.Name & s
End Select
End Sub


Run StartChartEvents, then click on any series in any chart

Regards,
Peter T


"Mike Archer" wrote in message
...
The charts are on a worksheet. I would like the event to run when the
user
clicks on a series label (like trying to change the text in the label).

--
Thanks,
Mike


"Peter T" wrote:

Is that for a chart-sheet or embedded chart. If the latter, do you want
to
trap the selection event of just one chart or all charts on a sheet or
all
in a workbook.

Regards,
Peter T


"Mike Archer" wrote in message
...
Hello. Is there a way to get the name or index of a series collection
that
has been clicked?
Something like:
MsgBox ActiveChart.SeriesCollection.Selected.Name
or
MsgBox ActiveChart.SeriesCollection.Selected.Index

Of course, those examples don't work.

Thanks,
Mike






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
SeriesCollection Object Issue Ronald R. Dodge, Jr.[_2_] Excel Programming 9 March 24th 08 08:56 PM
Method 'SeriesCollection' of object '_Chart'failed Dennis Mak[_2_] Excel Programming 0 July 8th 06 07:49 AM
Add method of SeriesCollection object clears Windows clipboard Richo Excel Programming 0 June 2nd 06 04:27 PM
Formatting a new seriescollection in a chart object Paul Willman Excel Programming 2 August 24th 04 08:22 PM
Adding to the SeriesCollection of a chart object in VB6 E_R[_27_] Excel Programming 0 August 24th 04 06:38 PM


All times are GMT +1. The time now is 02:52 AM.

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

About Us

"It's about Microsoft Excel"