A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Charts and Charting
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Changing ChartTypes will not change the color of the Series



 
 
Thread Tools Display Modes
  #1  
Old March 8th, 2010, 03:48 PM posted to microsoft.public.excel.charting
EAB1977
external usenet poster
 
Posts: 35
Default Changing ChartTypes will not change the color of the Series

I have Excel 2007 and trying to make this compatible with users that
have Excel 2002/2003.

I am having a hard time with the code below. When I change a specific
series from a stacked chart to a line and then try to change the
color, I am not successful. I am successful with changing the chart
type, however.

'Create the Average Line
.ActiveChart.PlotArea.Select
.ActiveChart.SeriesCollection.NewSeries
y = .ActiveChart.SeriesCollection.Count
.ActiveChart.SeriesCollection(y).Values = "=Sheet2!R" & intRow
+ 1 & "C2:R" & intRow + 1 & "C" & rst.Fields.Count
.ActiveChart.SeriesCollection(y).Name = "=""Average"""
.ActiveChart.SeriesCollection(y).Select
.ActiveChart.SeriesCollection(y).AxisGroup = 1
.ActiveChart.SeriesCollection(y).ChartType = 4
.ActiveChart.SeriesCollection(y).Interior.Color = RGB(0, 0, 0)

I have tried everyhing and I can't figure it out. Any help you can
shed will be greatly apprecitated.
  #2  
Old March 9th, 2010, 02:59 PM posted to microsoft.public.excel.charting
Jon Peltier[_2_]
external usenet poster
 
Posts: 386
Default Changing ChartTypes will not change the color of the Series

A line chart series has no Interior. Try MarkerBackgroundColor and
related properties.

Best approach when you're stuck on syntax is to open Excel 2003, turn on
the macro recorder, do what you want you program to do, and make use of
the recorded code.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 3/8/2010 10:48 AM, EAB1977 wrote:
I have Excel 2007 and trying to make this compatible with users that
have Excel 2002/2003.

I am having a hard time with the code below. When I change a specific
series from a stacked chart to a line and then try to change the
color, I am not successful. I am successful with changing the chart
type, however.

'Create the Average Line
.ActiveChart.PlotArea.Select
.ActiveChart.SeriesCollection.NewSeries
y = .ActiveChart.SeriesCollection.Count
.ActiveChart.SeriesCollection(y).Values = "=Sheet2!R"& intRow
+ 1& "C2:R"& intRow + 1& "C"& rst.Fields.Count
.ActiveChart.SeriesCollection(y).Name = "=""Average"""
.ActiveChart.SeriesCollection(y).Select
.ActiveChart.SeriesCollection(y).AxisGroup = 1
.ActiveChart.SeriesCollection(y).ChartType = 4
.ActiveChart.SeriesCollection(y).Interior.Color = RGB(0, 0, 0)

I have tried everyhing and I can't figure it out. Any help you can
shed will be greatly apprecitated.

  #3  
Old March 12th, 2010, 02:09 PM posted to microsoft.public.excel.charting
AdamV[_2_]
external usenet poster
 
Posts: 38
Default Changing ChartTypes will not change the color of the Series

Try something like this:
ActiveChart.SeriesCollection(y).Border.ColorIndex = 14


Yes, you need a good old colour index value to set this (if you need to
retain compatibility as you have said).

Jon P has some useful thoughts on palettes and a utility to change them
so you can get sensible colours too, from his website linked below.

Hope this helps

Adam

On 09/03/2010 14:59, Jon Peltier wrote:
A line chart series has no Interior. Try MarkerBackgroundColor and
related properties.

Best approach when you're stuck on syntax is to open Excel 2003, turn on
the macro recorder, do what you want you program to do, and make use of
the recorded code.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/


On 3/8/2010 10:48 AM, EAB1977 wrote:
I have Excel 2007 and trying to make this compatible with users that
have Excel 2002/2003.

I am having a hard time with the code below. When I change a specific
series from a stacked chart to a line and then try to change the
color, I am not successful. I am successful with changing the chart
type, however.

'Create the Average Line
.ActiveChart.PlotArea.Select
.ActiveChart.SeriesCollection.NewSeries
y = .ActiveChart.SeriesCollection.Count
.ActiveChart.SeriesCollection(y).Values = "=Sheet2!R"& intRow
+ 1& "C2:R"& intRow + 1& "C"& rst.Fields.Count
.ActiveChart.SeriesCollection(y).Name = "=""Average"""
.ActiveChart.SeriesCollection(y).Select
.ActiveChart.SeriesCollection(y).AxisGroup = 1
.ActiveChart.SeriesCollection(y).ChartType = 4
.ActiveChart.SeriesCollection(y).Interior.Color = RGB(0, 0, 0)

I have tried everyhing and I can't figure it out. Any help you can
shed will be greatly apprecitated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:58 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.