Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
Ed
 
Posts: n/a
Default how do I make multiple pie charts at the same time?

I have multiple lines of data and I want to make multiple pie charts (over
50) at the same time by simply going down the row and creating a pie chart
with each row. I can't figure out a macro on how to do it, and simply
copying and pasting and then deleting a series resets all of my formatting
preferences!
  #2   Report Post  
Posted to microsoft.public.excel.charting
Jon Peltier
 
Posts: n/a
Default how do I make multiple pie charts at the same time?

A long time ago (nearly 5 years!) I posted this macro that makes a pie for
each row in the data range. The data is in A:E, with the category labels in
A1:E1 and the values in each row below that. The charts are overlapped ot
the right of the data.


Sub LotsaPies()

' Macro recorded and adjusted 2/23/01 by Jon Peltier



Dim obChart As ChartObject

Dim myrow As Long

Dim myrows As Long



' How many pies to make

myrows = WorksheetFunction.CountA(ActiveSheet.Range("A:A"))

For myrow = 2 To myrows + 1

' Make a pie with the top left corner in column F

' in same row as data, as wide as columns F through K,

' 17 rows high

' Adjust to suit your tastes

Set obChart = ActiveSheet.ChartObjects.Add(Left:=[F:F].Left, _

Top:=[F1].Offset(myrow - 1, 0).Top, _

Width:=[F:K].Width, Height:=[2:18].Height)

With obChart.Chart

.ChartType = xlPie

' A1:E1 has legend entries

' A(myrow):E(myrow) has data

.SetSourceData PlotBy:=xlRows, Source:= _

ActiveSheet.Range("A1:E1,A" & myrow & ":E" & myrow)

.ApplyDataLabels Type:=xlDataLabelsShowValue, _

LegendKey:=False, HasLeaderLines:=True

.HasTitle = True

With .ChartTitle

.Font.Bold = True

.AutoScaleFont = False

.Left = 88

.Top = 1

End With

With .PlotArea

.Border.LineStyle = xlNone

With .Interior

.ColorIndex = 2

.PatternColorIndex = 1

.Pattern = xlSolid

End With

.Height = 50

.Left = 22

.Top = 40

.Width = 156

.Height = 156

End With

' For some reason, I have to activate the chart

' to fix the fonts (otherwise they're all size 2)

.Parent.Activate

With .ChartArea

.Font.Size = 10

.AutoScaleFont = False

End With

End With



' Now deactivate the chart

ActiveWindow.Visible = False

Windows(ActiveWorkbook.Name).Activate

ActiveCell.Activate



Next

End Sub



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


"Ed" wrote in message
...
I have multiple lines of data and I want to make multiple pie charts (over
50) at the same time by simply going down the row and creating a pie chart
with each row. I can't figure out a macro on how to do it, and simply
copying and pasting and then deleting a series resets all of my formatting
preferences!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Print all charts in a workbook (multiple worksheets) aewsaws Charts and Charting in Excel 4 May 12th 23 03:45 AM
Multiple charts in ChartSpace; problems with double Categories hstaaks Charts and Charting in Excel 0 May 2nd 05 10:50 PM
Multiple charts Derrick Robinson Excel Worksheet Functions 3 May 2nd 05 07:45 PM
Printing multiple portait and landscape workbooks at the same time Sbaitso Excel Discussion (Misc queries) 7 March 30th 05 05:49 PM
Macro for multiple charts JS Excel Worksheet Functions 1 November 19th 04 03:44 AM


All times are GMT +1. The time now is 04:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"