G
greg7468
Hi all,
I am very new to VBA.(but trying)
I have the following code to produce a chart.
Sub AddChartObject()
Dim myChtObj As ChartObject
'
Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=20, Width:=700, Top:=120, Height:=225)
myChtObj.Chart.SetSourceData
Source:=Sheets("Sheet1").Range("a3:a6"), _
PlotBy:=xlRows
myChtObj.Chart.ChartType = xlColumnStacked
End Sub
I needed the chart to show the data in each column stacked ontop of
each other (just that column) and worked out to put the plotby rows
command in. That worked great for the first series.
I now have the following code to add a new series,
Sub AddNewSeriesAL0100()
With ActiveChart.SeriesCollection.NewSeries
..Values = ActiveSheet.Range("b3:b6")
End With
End Sub
but when I do it does not stack the data ontop of each other in the
chart, it puts them side by side. I have tried putting the plotby rows
command in but it doesn't seem to work for the new series.
Can anyone help me out to be able to stack any new series.
Thanks for any assistance.
I am very new to VBA.(but trying)
I have the following code to produce a chart.
Sub AddChartObject()
Dim myChtObj As ChartObject
'
Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=20, Width:=700, Top:=120, Height:=225)
myChtObj.Chart.SetSourceData
Source:=Sheets("Sheet1").Range("a3:a6"), _
PlotBy:=xlRows
myChtObj.Chart.ChartType = xlColumnStacked
End Sub
I needed the chart to show the data in each column stacked ontop of
each other (just that column) and worked out to put the plotby rows
command in. That worked great for the first series.
I now have the following code to add a new series,
Sub AddNewSeriesAL0100()
With ActiveChart.SeriesCollection.NewSeries
..Values = ActiveSheet.Range("b3:b6")
End With
End Sub
but when I do it does not stack the data ontop of each other in the
chart, it puts them side by side. I have tried putting the plotby rows
command in but it doesn't seem to work for the new series.
Can anyone help me out to be able to stack any new series.
Thanks for any assistance.