Selecting specific excel charts using VBA

  • Thread starter Thread starter Mithi_M
  • Start date Start date
M

Mithi_M

Hello all,

Say I have an excel macro that runs on a weekly basis to generate 4
different charts in one worksheet. I now need to write a new macro to
select specifically the first and the third chart from the list of 4,
and paste the 2 charts to powerpoint. Does anyone have any idea how to
write a macro for this?

The difficulty I am facing is that, the 4 charts will not have a
standardized name, since the "Chart #" will keep on increasing when
the 1st macro regenerates new sets of graphs weekly. Is there a way to
get VB to select specifically the first chart as Object 1 and the 3rd
chart as Object 3 from the entire worksheet?

Hope someone can help. I am running out of ideas. Thanks in advance
for your help.

Rgds,
Mithi
 
Hi Mithi
Why not create variables in your code and assign chart names to each
variable when you are creating your charts ?
You could then use these variables in the next step.

HTH
Cordially
Pascal

Why not assign variables while
 
Mithi -

If you can't use the variable approach for whatever reason, you could
assign a more meaningful name to the chart, which the next macro can
refer to when copying. This page talks about naming charts:

http://peltiertech.com/Excel/ChartsHowTo/NameAChart.html

and this page has some pointers for moving charts to PowerPoint:

http://peltiertech.com/Excel/XL_PPT.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______
 

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