Colouring error bars in a chart

  • Thread starter Graham Whitehead
  • Start date
G

Graham Whitehead

Hi, I have draw a chart which has three series on it. I want to colour the
error based on the series they belong to. When I record the process I get:

ActiveSheet.ChartObjects("Chart 278").Activate
ActiveChart.SeriesCollection(1).ErrorBars.Select
With Selection.Border
.LineStyle = xlContinuous
.ColorIndex = 3
.Weight = xlThin
End With
Selection.EndStyle = xlNoCap

So I have tried to work this into something which might work:

With chtChart
.SeriesCollection(1).ErrorBars.Select
With Selection.Border
.LineStyle = xlContinuous
.ColorIndex = 3
.Weight = xlThin
End With
End With

But this is giving me an error. Can anyone see what is wrong?
 
B

Bernie Deitrick

Graham,

This should work: you need to work with the chartobject's chart, a step that isn't recorded by the
macro recorder.

With chtChart.Chart
With .SeriesCollection(1).ErrorBars
With .Border
.LineStyle = xlContinuous
.ColorIndex = 3
.Weight = xlThin
End With
End With
End With

HTH,
Bernie
MS Excel MVP
 

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