View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Build custom charts in Excel and copy them to PowerPoint

I would set up dynamic ranges (names). Cell F1 contains a number between 1
and 350 (or whatever number of lines you need to plot). Create names by
going to Insert menu Names Define. The names and their refers-to
formulas are he

Name Refers To
MyTitle =OFFSET($A$1,$F$1,0)
MyMin =OFFSET($B$1,$F$1,0)
MyMed =OFFSET($C$1,$F$1,0)
MyDat =OFFSET($D$1,$F$1,0)
MyMax =OFFSET($E$1,$F$1,0)

So when I change the value in F1, a different row is referenced in these
names. The chart will use these names, so changing F1 changes the chart.

Make the chart using any row of data. Change the series formula as follows.

Series 1 will look like this assuming row 2 was used to create it and the
worksheet is named Sheet1:

=SERIES(Sheet1!$B$1,,Sheet1!$B$2,1)

Change it to this:

=SERIES(Sheet1!$B$1,,Sheet1!MyMin,1)

Excel is likely to change it to

=SERIES(Sheet1!$B$1,,Book1.xls!MyMin,1)

change the other cell references to the names created above.

Now you need some kind of macro. I have some sample code to copy Excel
charts to PowerPoint he

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

In the macro, set up the link to PowerPoint first, then set up a loop that
works like this (pseudocode):

For i=1 to 350
ActiveSheet.Range(:F1:).Value = i
' create a new slide (use code from the web site)
' copy the chart
' paste onto the new slide
Next


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



"mustang25" wrote in message
...
Apologies in advance for the lengthy request. I have no idea if this is
even
possible to do with a macro.

I have roughly 350 lines of data that I need to create charts from. Each
line will generate its own chart. I need cylinder charts that fit the
following criteria (all chart options set to default unless noted
differently
below):

960 pixels (136.43 column width) wide X 578 pixels (34 cells @ 12.75 row
height) high
The Chart Title is in the A column
The B1 cell contains the x-axis label "Min"
The C1 cell contains the x-axis label "Median"
The D1 cell contains the x-axis label "Data"
The E1 cell contains the x-axis label "Max"
The "Min" Cylinder should be yellow
The "Median" Cylinder should be blue
The "Data" cylinder should be red
The "Max" cylinder should be black
Data labels should be present, above the appropriate cylinder, and should
show value
The Chart Area should have no border and no background
Gridlines should be Gray - 25%
The Floor Area should also be Gary - 25%

After all of this, the chart should be copied to its own slide in an open
PowerPoint Presentation, the chart should delete (because of Excel's
built-in
number-of-chart limitations), and the process repeat until all 350 or so
rows
have been charted.

Simple, right?

Since I know next to nothing about vb, macros, and the like, it would be
much appreciated if any responses could include which references to turn
on,
etc. Also, since I'm guessing that a macro like this will take some time
to
write, would anyone who decides to tackle this please let me know you are
doing so? I don't mind waiting in the least, but if this is too daunting
of
a challenge, I'd like to know that no one is working on it so I can get to
work on building these charts manually. Many thanks. :)