dhartford
12-27-2008, 09:27 PM
I'm building Stacked Column chart with VBA. What I want is to stack the data in column I and G together for every compay and separated by company. Folowing is the code which gives me a big trunk instead of the blocks separated by company. The column A is the company name.
Thank you very much in advance.
....
Dim ExhastionSeries As Series
objChart.ChartType = xlColumnStacked
For Each ExhastionSeries In objChart.SeriesCollection
ExhastionSeries.Delete
Next ExhastionSeries
For j = 3 To objWS.Cells(3, 1).CurrentRegion.Rows.Count + 1
Set ExhastionSeries = objChart.SeriesCollection.NewSeries
With ExhastionSeries
.Formula = "=series(" & _
"'Chart_Data'!$A$" & j & "," & _
"'Chart_Data'!$I$" & j & "," & _
"'Chart_Data'!$I$" & j & ",1)"
End With
Next j
For j = 3 To objWS.Cells(3, 1).CurrentRegion.Rows.Count + 1
Set ExhastionSeries = objChart.SeriesCollection.NewSeries
With ExhastionSeries
.Formula = "=series(" & _
"'Chart_Data'!$A$" & j & "," & _
"'Chart_Data'!$G$" & j & "," & _
"'Chart_Data'!$G$" & j & ",2)"
End With
Next j
Thank you very much in advance.
....
Dim ExhastionSeries As Series
objChart.ChartType = xlColumnStacked
For Each ExhastionSeries In objChart.SeriesCollection
ExhastionSeries.Delete
Next ExhastionSeries
For j = 3 To objWS.Cells(3, 1).CurrentRegion.Rows.Count + 1
Set ExhastionSeries = objChart.SeriesCollection.NewSeries
With ExhastionSeries
.Formula = "=series(" & _
"'Chart_Data'!$A$" & j & "," & _
"'Chart_Data'!$I$" & j & "," & _
"'Chart_Data'!$I$" & j & ",1)"
End With
Next j
For j = 3 To objWS.Cells(3, 1).CurrentRegion.Rows.Count + 1
Set ExhastionSeries = objChart.SeriesCollection.NewSeries
With ExhastionSeries
.Formula = "=series(" & _
"'Chart_Data'!$A$" & j & "," & _
"'Chart_Data'!$G$" & j & "," & _
"'Chart_Data'!$G$" & j & ",2)"
End With
Next j