If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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! |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Adding a time stamp to "notes" & Changing multiple "follow-up time | airpreston | Contacts | 0 | June 23rd, 2005 11:07 PM |
Use first record found in expression? | CASJAS | Running & Setting Up Queries | 17 | July 22nd, 2004 09:21 PM |
Can multiple users open and make changes to file at same time - Not Read-Only? | Ken | Powerpoint | 1 | June 14th, 2004 07:46 PM |
Multiple charts at the same time | GPG | Charts and Charting | 2 | March 29th, 2004 10:49 PM |
printing multiple charts per page | Pablo | Charts and Charting | 1 | February 27th, 2004 05:37 PM |