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"
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"