Setting chart size in macro

G

Guest

I have posted questions about this previously on different formus but I have
never really gotten an answer to this question. I have a macro that is
supposed to generate a report. The report is already made, what my macro does
is to set the input data for some charts and tables. Now the charts already
exist so, but they are poorly made. I want to set the size of the plotareas,
the chart area is of no importance. As I understand it though it is the chart
area that sets the plot area (in some way). I know how to set the plot area
but that wont help me since the actual size of the chart is set by the chart
area. My question(s):

1) How do you write the code that sets the chart area? It seems easy but I
have tried and it has not worked for me..
2) Is it possible to set the size of an already existing chart? How do you
write the code for that? Is it the same as 1)?

Please help me out! As I said I have tried to get an anser on this topic
before but I have not really gotten an answer. Recoprding a macro is not an
option since the code you get from there is useless for my task. Again please
help me! I would be very thankful for any inputs on this seemingly and for a
vba initiated person fairly easy task..needless to say my knowledge in this
area is limited at best...Thank you!!!
_________________
 
G

Guest

Bloom,

The only difference between setting the size of an already existing chart
and a new chart is that you will have to select the existing chart, or know
the name of the chart.

Generally if a chart is just added you can use the ActiveChart. property.
If the chart is existing you will need to call it out by name, ie for a chart
named "Blooms Chart" on sheet1 you would need to code
Sheet1.ChartObject("Blooms Chart"). to refer to that chart.

You can also use a for each statement to go through each chart if you want
them to be all the same size.

For Each cht In ChartObjects
cht.Height = 200
cht.width = 300
Next cht

Mike
 

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

Similar Threads


Top