PDA

View Full Version : Solved: Stacked Column Chart with VBA



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

Bob Phillips
12-28-2008, 10:57 AM
Post the workbook with the data as well.

lucas
12-28-2008, 12:20 PM
dhartford, please don't post multiple threads asking the same question. I have deleted your other identical thread. It causes confusion and will not result in faster responses........quite the opposite if it is discovered by people who are looking at your problem.

dhartford
12-28-2008, 02:07 PM
dhartford, please don't post multiple threads asking the same question. I have deleted your other identical thread. It causes confusion and will not result in faster responses........quite the opposite if it is discovered by people who are looking at your problem.

Lucas,

Sorry, I didn't mean to post 2nd time. The reason is that the msg poped up to indicated that my 1st tread didn't go through which is not true

Thanks.

lucas
12-28-2008, 02:19 PM
No problem dhartford. It has happened to me before too. Thanks for replying and letting me know it was a board snafu........

dhartford
12-29-2008, 01:37 PM
No problem dhartford. It has happened to me before too. Thanks for replying and letting me know it was a board snafu........

Thanks Lucas for your understanding.

Could you help me on this issue (thread)? 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.

Aussiebear
01-04-2009, 12:44 PM
Please post a workbook so we can assist you here?

dhartford
01-04-2009, 01:39 PM
Please post a workbook so we can assist you here?

I figured out how to work it out. Thanks.

lucas
01-04-2009, 01:56 PM
Well, it would have been nice if you had shared your solution for others to benifit from. It would also have saved Ted(Aussibear) from posting followups on a thread that you had found a solution to if you had at least marked your thread solved using the thread tools at the top of the page.