ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing the colour of a bar on a chart (https://www.excelbanter.com/excel-programming/368629-changing-colour-bar-chart.html)

Graham Whitehead

Changing the colour of a bar on a chart
 
I have created a column chart and am now trying to change the colour of one
of the bars. Here is the code I am using:

With chtChart
ActiveChart.SeriesCollection(1).Points(2).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End With

But to an avail. can anyone see what is wrong with it?



excelent

Changing the colour of a bar on a chart
 
try

ActiveSheet.ChartObjects(1).Activate
With chtChart
ActiveChart.SeriesCollection(1).Points(2).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End With



Peter T

Changing the colour of a bar on a chart
 
That code should work though "With chtChart..End With" does nothing in your
useage.
You don't need to select the chart

With ActiveSheet.ChartObjects(1).Chart
.SeriesCollection(1).Points(2).Interior.ColorIndex = 3
End With

Regards,
Peter T

"Graham Whitehead" wrote in message
...
I have created a column chart and am now trying to change the colour of

one
of the bars. Here is the code I am using:

With chtChart
ActiveChart.SeriesCollection(1).Points(2).Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
End With

But to an avail. can anyone see what is wrong with it?






All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com