ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Identifing charts by user selection (https://www.excelbanter.com/excel-programming/361109-identifing-charts-user-selection.html)

Dan Thompson

Identifing charts by user selection
 
Hi All,
I have a spread sheet with several different chart objects within it.
I would like to write a simple macro so that If I cick (select) any one of
the charts with-in the current spread sheet I am viewing and than run my
macro, a msgbox will pop up and give me the Name of the chart object and the
index number of the chart object.

Any help would be greatly appreciated
Thanks,
Dan Thompson.

Andy Pope

Identifing charts by user selection
 
Hi,

Try this,

Sub x()
With ActiveChart.Parent
MsgBox .Name & " Index " & .Index
End With
End Sub

Cheers
Andy

Dan Thompson wrote:
Hi All,
I have a spread sheet with several different chart objects within it.
I would like to write a simple macro so that If I cick (select) any one of
the charts with-in the current spread sheet I am viewing and than run my
macro, a msgbox will pop up and give me the Name of the chart object and the
index number of the chart object.

Any help would be greatly appreciated
Thanks,
Dan Thompson.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

Dan Thompson

Identifing charts by user selection
 
Thanks Andy that seemd to do the trick.

Dan Thompson.

"Andy Pope" wrote:

Hi,

Try this,

Sub x()
With ActiveChart.Parent
MsgBox .Name & " Index " & .Index
End With
End Sub

Cheers
Andy

Dan Thompson wrote:
Hi All,
I have a spread sheet with several different chart objects within it.
I would like to write a simple macro so that If I cick (select) any one of
the charts with-in the current spread sheet I am viewing and than run my
macro, a msgbox will pop up and give me the Name of the chart object and the
index number of the chart object.

Any help would be greatly appreciated
Thanks,
Dan Thompson.


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com