Update data and Y error bars in a chart

R

Raul

I'm using the following methodology for updating a number of charts in a
workbook. The methodology works but I'm wondering if there is a better way
to update the data in a number of charts in a workbook as well as update the
Y error bars for a number of data series in a chart?

For i = 1 To 10
GA(i, 4) = "U5:U" & LRA(i, 3) & ",AD5:AD" & LRA(i, 3) & ",AF5:AF" & LRA(i,
3) & ""
GA(i, 5) = "AE6:AE" & LRA(i, 3) & ""
GA(i, 6) = "AG6:AG" & LRA(i, 3) & ""

Sheets(GA(i, 3)).Select
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets(GA(i, 2)).Range(GA(i, 4)), _
PlotBy:=xlColumns

ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).ErrorBar Direction:=xlY,
Include:=xlBoth, _
Type:=xlCustom, Amount:=Sheets(GA(i, 2)).Range(GA(i, 5)), _
MinusValues:=Sheets(GA(i, 2)).Range(GA(i, 5))
ActiveChart.SeriesCollection(2).Select
ActiveChart.SeriesCollection(2).ErrorBar Direction:=xlY,
Include:=xlBoth, _
Type:=xlCustom, Amount:=Sheets(GA(i, 2)).Range(GA(i, 6)), _
MinusValues:=Sheets(GA(i, 2)).Range(GA(i, 6))

Next i

Thanks in advance,
Raul
 

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

Top