N
news.verizon.net
Hi,
I can make a chartsheet containing 9 or more embeded charts in one sheet.
And I can move them around using a reference to a "Shapes" object. Can
someone please give me code which will show how I can reference the chart
inside my loop. I'm trying to set the chart series data, or references (in
a scatter plot) and then I also want to format the chart details ( ea. axis
scale, etc).
Thanks very much in advance.
BillReese
=======================================================================================================
Dim xRow As Long, yCol As Long
Dim Cht As Chart, sc as SeriesCollection
Set Cht = .Sheets.Add(before:=.Sheets(1), Type:=xlChart)
Cht.ChartArea.Clear
For xRow = 0 To 2
For yCol = 0 To 2
Set Cht = Cht.ChartObjects.Add(1, 1, 60, 60)
Cht.Name = xRow & yCol
Cht.Shapes(xRow & yCol).Left = ((yCol +
1) * 100) + 10
Cht.Shapes(xRow & yCol).Top = ((xRow +
1) * 100) + 10
'*************** CODE BELOW DOES NOT DO
ANYTHING
Cht.PlotArea.Fill.OneColorGradient
msoGradientHorizontal, Variant:=1, degree:=1
Set sc = Cht.SeriesCollection
sc.Add ""
With sc
.YValues = "={1,2,3,4}"
.XValues = "={10,20,30,40}"
End With
'*************************************************
Next
Next
I can make a chartsheet containing 9 or more embeded charts in one sheet.
And I can move them around using a reference to a "Shapes" object. Can
someone please give me code which will show how I can reference the chart
inside my loop. I'm trying to set the chart series data, or references (in
a scatter plot) and then I also want to format the chart details ( ea. axis
scale, etc).
Thanks very much in advance.
BillReese
=======================================================================================================
Dim xRow As Long, yCol As Long
Dim Cht As Chart, sc as SeriesCollection
Set Cht = .Sheets.Add(before:=.Sheets(1), Type:=xlChart)
Cht.ChartArea.Clear
For xRow = 0 To 2
For yCol = 0 To 2
Set Cht = Cht.ChartObjects.Add(1, 1, 60, 60)
Cht.Name = xRow & yCol
Cht.Shapes(xRow & yCol).Left = ((yCol +
1) * 100) + 10
Cht.Shapes(xRow & yCol).Top = ((xRow +
1) * 100) + 10
'*************** CODE BELOW DOES NOT DO
ANYTHING
Cht.PlotArea.Fill.OneColorGradient
msoGradientHorizontal, Variant:=1, degree:=1
Set sc = Cht.SeriesCollection
sc.Add ""
With sc
.YValues = "={1,2,3,4}"
.XValues = "={10,20,30,40}"
End With
'*************************************************
Next
Next