Creating Charts in VBA Code

J

julia.stone

I am new to VBA and I have a question related to creating charts. I'd
appreciate any tips on how to accomplish this ... thanks in advance.

I have been trying to accomplish displaying charts by clicking on
Option buttons. And I am still not quite there (some of my solutions
have been very slow, etc.).

I have 5 different charts that I have located the data ranges (but for
3 of the charts the data range is a SERIES) that are needed.

For example I have

2 Pie Charts and the data ranges are in a series
1 Combination Chart
2 Stacked Colum Charts

These all exist now on a worksheet that I will need to get rid of. I
want to click on an option button, and display each chart, and protect
the chart. I will want to display one chart at a time. But since I
will need to specify my data ranges in the code, I am not quite clear
on how this piece of code should flow. Can anyone point me in the
right direction?

Thanks,
Julia
 
F

Fredrik Wahlgren

I am new to VBA and I have a question related to creating charts. I'd
appreciate any tips on how to accomplish this ... thanks in advance.

I have been trying to accomplish displaying charts by clicking on
Option buttons. And I am still not quite there (some of my solutions
have been very slow, etc.).

I have 5 different charts that I have located the data ranges (but for
3 of the charts the data range is a SERIES) that are needed.

For example I have

2 Pie Charts and the data ranges are in a series
1 Combination Chart
2 Stacked Colum Charts

These all exist now on a worksheet that I will need to get rid of. I
want to click on an option button, and display each chart, and protect
the chart. I will want to display one chart at a time. But since I
will need to specify my data ranges in the code, I am not quite clear
on how this piece of code should flow. Can anyone point me in the
right direction?

Thanks,
Julia

Since you already seem to know how to create charts manually, your best
option is to turn on the macro recorder and then recrate the charts. Use
Tools|Macro|Record new macro. A new window will appear with a stop button
that you must press on when you're done. Using tools|Macro|Macros... you can
view the generated code. I use the Swedish version of Excel so the
translation may not be perfect. Does this answer your question?

/Fredrik
 
J

julia.stone

Not really but thanks for the reply. One of my issues is that I am not
quite sure of the most efficient way to do this. I was hoping someone
might read my post and confirm that my ideas are in the right
direction, or share with me a better way to handle this. I am not
quite sure how to deal with the data in a series. It might help to see
a code sample of how to do this. I will give the macro recorder a try.
Thx.
 
T

Tom Ogilvy

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

Top