View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jon Peltier Jon Peltier is offline
external usenet poster
 
Posts: 6,582
Default Creating Multiple Graphs in Excel 2003

Post the piece of code you were troubled with.

Not knowing what that looks like, here's code I posted a while back for
creating one pie chart per row of data:

Sub OnePieChartPerRow()

Dim rngChartData As Range

Dim iRowIx As Integer, iRowCt As Integer, iColCt As Integer

Dim oChart As ChartObject

Dim NewSrs As Series


If Not TypeName(Selection) = "Range" Then Exit Sub


Set rngChartData = Selection

iRowCt = rngChartData.Rows.Count

iColCt = rngChartData.Columns.Count


For iRowIx = 2 To iRowCt

Set oChart = ActiveSheet.ChartObjects.Add(Top:=25 + (iRowIx - 2) * 200, _

Height:=200, Left:=450, Width:=300)

Set NewSrs = oChart.Chart.SeriesCollection.NewSeries

oChart.Chart.ChartType = xlPie

With oChart.Chart.PlotArea

..Border.LineStyle = xlNone

..Interior.ColorIndex = xlNone

End With

With NewSrs

'' Name in first column

..Name = rngChartData.Cells(iRowIx, 1)

..Values = rngChartData.Cells(iRowIx, 2).Resize(1, iColCt - 1)

'' XValues in first row

..XValues = rngChartData.Cells(1, 2).Resize(1, iColCt - 1)

End With

Next


End Sub


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


"Don" wrote in message
ups.com...
I am trying to create a graph for each row of a worksheet, by creating
a macro. Using variables, and a FOR, NEXT statement, I can select the
title row and the data row for each row, and rename each chart
produced. But I cannot replace the original selection range with the
variable range "myMultipleRange", in the chart part of the macro. Does
anyone have any idea how to do this?