How to show Excel chart VBA 'name'?

  • Thread starter Thread starter mbobro
  • Start date Start date
M

mbobro

Hi,

I have several charts on every Excel Worksheet. I'd like to program VB
to select them. In order to do so, I need to know the 'name' of eac
chart.

How to display it quickly?

Maybe you know a kind of add-in that has a kind of nutton like 'sho
chart name'?

Thanks,


Micha
 
Hi Michal,

Just hold the Shift key before selecting the chart.
The name will be displayed in the Name Box (where the cell address is
normally displayed)
Hi,

I have several charts on every Excel Worksheet. I'd like to program VBA
to select them. In order to do so, I need to know the 'name' of each
chart.

How to display it quickly?

Maybe you know a kind of add-in that has a kind of nutton like 'show
chart name'?

Thanks,


Michal

--

Cheers
Andy

http://www.andypope.info
 
You might not even need the names.

To loop through the charts one by one, use a construction like this:

Dim oChtOb as ChartObject
For Each oChtOb in ActiveSheet.ChartObjects
' Do your stuff to oChtOb or to its chart, oChtOb.Chart
Next

To select all charts, use:

ActiveSheet.ChartObjects.Select

In general, you don't even need to select a chart to change it. Just
refer to the part that needs adjusting:

oChtOb.Chart.Axes(2,1).MaximumScale = 100

When using recorded macros, everywhere you see this:

SomeObject.Select
Selection.DoSomething

you can streamline things with this:

SomeObject.DoSomething

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top