chartobject and naming

bestox

Board Regular
Joined
Apr 2, 2009
Messages
82
i do want adress a chartobject out of a chartarea. let s say i have three chartobjects on the chartarea, so

Code:
activesheet.chartobjects(1).name
activesheet.chartobjects(2).name
activesheet.chartobjects(3).name

gives me the three names of the chartobjects, so this is:

chart 1
chart 7
chart 8

What i am looking for is a method/vba code, to get the name of the chartobject of my selection (i select a chartobject in excel with cursor).

what i found is this:

Code:
selection.parent.name

assuming i selected chartobject 2, so chart 7, this actually returns a string, which is a bit difficult: since i use german language settings, it returns me something like: sheetname Diagramm 7 (diagramm is german word for chart).

this made my skeptic!

i now did this:

Code:
activesheet.chartobjects(2).name = "hello"

still selected chartobject 2,

Code:
selection.parent.name

returns still sheetname Diagramm 7 (instead of sheetname hello).

anyone knows why this is? or: anyone knows a solution, how to get the name of the chartobject with Selection using vba?

thank s for any comment!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Forum statistics

Threads
1,215,438
Messages
6,124,873
Members
449,192
Latest member
MoonDancer

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top