Adding multiple series to a dynamic chart

Y

YehWei

Hi,

I've already assigned named ranges for creating dynamic charts. Would
like to seek assistance in getting the correct code to loop through a
range (that searches for the last row and last column) and add series
starting from column 4.

I've place *** to the code which I need help on, and probably on how to
efficient loop through the columns from 4 to last column to add the
series.

Any help appreciated. Thank you very much.

'Charts.Add
ActiveChart.ChartType = xlColumnStacked

NumRows = 5
NumCols = 60

*** ActiveChart.SetSourceData Source:= _
Sheets("Lot Lvl").Range("A1:NumRows" & " & NumRows + 1 & ",
"NumCols:NumRows"), _
PlotBy:=xlColumns

ActiveChart.SeriesCollection(1).Name = "='Lot Lvl'!R1C4"
ActiveChart.SeriesCollection(1).XValues = "='Lot Lvl'!rngLotCol1"
ActiveChart.SeriesCollection(1).Values = "='Lot Lvl'!rngLotCol4"

ActiveChart.Location Where:=xlLocationAsNewSheet, Name:="Trend
Chart"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top