ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting specific excel charts using VBA (https://www.excelbanter.com/excel-programming/304818-selecting-specific-excel-charts-using-vba.html)

Mithi_M

Selecting specific excel charts using VBA
 
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

papou[_9_]

Selecting specific excel charts using VBA
 
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_M" a écrit dans le message de
om...
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




Debra Dalgleish

Selecting specific excel charts using VBA
 
Jon Peltier has sample code in which a chart is assigned a variable as
it is created:

http://www.peltiertech.com/Excel/Cha....html#addchart

Mithi_M wrote:
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



--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html


Jon Peltier[_8_]

Selecting specific excel charts using VBA
 
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/ChartsH...ameAChart.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/
_______

Debra Dalgleish wrote:

Jon Peltier has sample code in which a chart is assigned a variable as
it is created:

http://www.peltiertech.com/Excel/Cha....html#addchart

Mithi_M wrote:

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







All times are GMT +1. The time now is 03:12 PM.

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