Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TG TG is offline
external usenet poster
 
Posts: 8
Default Apply different color to datalabels

I have a code that adds series to a chart.
I want to set the Datalabel.Interior.ColorIndex, but for some reason
the ClorIndex is not applyed to the DataLabel..

Any suggestion on why? Or how can i do this?

My current code includes:

With Sheets("Chart").SeriesCollection.NewSeries
.Name = Name
.XValues = XValue
.Values = YValue
.MarkerSize = 5
.ApplyDataLabels
.DataLabels.Interior.Pattern = xlSolid
.DataLabels.Interior.ColorIndex = C
.DataLabels.Border.ColorIndex = 1
.DataLabels.Font.Size = 7
.DataLabels.Position = xlCenter
.DataLabels.Orientation = 45
.DataLabels.ShowSeriesName = True
.DataLabels.ShowValue = False
End With

(where C is set to a valid value using a Select Case loop.)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Apply different color to datalabels

Your code works fine for me in 2003/2007, subject of course assigning a
value for C of between 1-56 or xlAutomatic/xlNone

FWIW if only using 2007/2010, although the code will work there is a new
preferred method of applying formats to interiors.

Regards,
Peter T


"TG" wrote in message
...
I have a code that adds series to a chart.
I want to set the Datalabel.Interior.ColorIndex, but for some reason
the ClorIndex is not applyed to the DataLabel..

Any suggestion on why? Or how can i do this?

My current code includes:

With Sheets("Chart").SeriesCollection.NewSeries
.Name = Name
.XValues = XValue
.Values = YValue
.MarkerSize = 5
.ApplyDataLabels
.DataLabels.Interior.Pattern = xlSolid
.DataLabels.Interior.ColorIndex = C
.DataLabels.Border.ColorIndex = 1
.DataLabels.Font.Size = 7
.DataLabels.Position = xlCenter
.DataLabels.Orientation = 45
.DataLabels.ShowSeriesName = True
.DataLabels.ShowValue = False
End With

(where C is set to a valid value using a Select Case loop.)


  #3   Report Post  
Posted to microsoft.public.excel.programming
TG TG is offline
external usenet poster
 
Posts: 8
Default Apply different color to datalabels

I'm using Excel 2010, but I can't get this code to work...

Regardless, what value er set, the interior color stays as 'white'.. ;-
(

What is the correct way to set interior for excel 2010??


On 25 Maj, 17:48, "Peter T" wrote:
Your code works fine for me in 2003/2007, subject of course assigning a
value for C of between 1-56 or xlAutomatic/xlNone

FWIW if only using 2007/2010, although the code will work there is a new
preferred method of applying formats to interiors.

Regards,
Peter T

"TG" wrote in message

...







I have a code that adds series to a chart.
I want to set the Datalabel.Interior.ColorIndex, but for some reason
the ClorIndex is not applyed to the DataLabel..


Any suggestion on why? Or how can i do this?


My current code includes:


* * * * * *With Sheets("Chart").SeriesCollection.NewSeries
* * * * * * * *.Name = Name
* * * * * * * *.XValues = XValue
* * * * * * * *.Values = YValue
* * * * * * * *.MarkerSize = 5
* * * * * * * *.ApplyDataLabels
* * * * * * * *.DataLabels.Interior.Pattern = xlSolid
* * * * * * * *.DataLabels.Interior.ColorIndex = C
* * * * * * * *.DataLabels.Border.ColorIndex = 1
* * * * * * * *.DataLabels.Font.Size = 7
* * * * * * * *.DataLabels.Position = xlCenter
* * * * * * * *.DataLabels.Orientation = 45
* * * * * * * *.DataLabels.ShowSeriesName = True
* * * * * * * *.DataLabels.ShowValue = False
* * * * * *End With


(where C is set to a valid value using a Select Case loop.)


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Apply different color to datalabels

Your code also works fine in 2010, but as I mentioned before only if an
appropriate value is first assigned to C (the colorindex)

If only using 2007/2010 instead you could do something like

..DataLabels.Format.Fill.ForeColor.RGB = RGB(150,150,250)
or instead of .RGB apply SchemeColor and maybe TintAndShade

Regards,
Peter T



"TG" wrote in message
...
I'm using Excel 2010, but I can't get this code to work...

Regardless, what value er set, the interior color stays as 'white'.. ;-
(

What is the correct way to set interior for excel 2010??


On 25 Maj, 17:48, "Peter T" wrote:
Your code works fine for me in 2003/2007, subject of course assigning a
value for C of between 1-56 or xlAutomatic/xlNone

FWIW if only using 2007/2010, although the code will work there is a new
preferred method of applying formats to interiors.

Regards,
Peter T

"TG" wrote in message

...







I have a code that adds series to a chart.
I want to set the Datalabel.Interior.ColorIndex, but for some reason
the ClorIndex is not applyed to the DataLabel..


Any suggestion on why? Or how can i do this?


My current code includes:


With Sheets("Chart").SeriesCollection.NewSeries
.Name = Name
.XValues = XValue
.Values = YValue
.MarkerSize = 5
.ApplyDataLabels
.DataLabels.Interior.Pattern = xlSolid
.DataLabels.Interior.ColorIndex = C
.DataLabels.Border.ColorIndex = 1
.DataLabels.Font.Size = 7
.DataLabels.Position = xlCenter
.DataLabels.Orientation = 45
.DataLabels.ShowSeriesName = True
.DataLabels.ShowValue = False
End With


(where C is set to a valid value using a Select Case loop.)


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Apply different color themes to worksheets withing a workbook kdarrow Excel Discussion (Misc queries) 2 August 26th 13 10:09 PM
Apply color of one cell to other Tigerxxx Excel Discussion (Misc queries) 3 June 15th 09 08:30 AM
How to apply different color on different columns and legends easily? [email protected] Charts and Charting in Excel 1 March 19th 07 09:04 AM
HOW CAN I APPLY A COLOR TO ENTIRE ROW USING CONDITIONAL FORMATT conditional format Excel Worksheet Functions 2 July 30th 06 05:37 PM
How do I apply color in cells ..color now shown only in print prev bonadimi Excel Worksheet Functions 1 April 25th 06 07:34 PM


All times are GMT +1. The time now is 07:22 AM.

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

About Us

"It's about Microsoft Excel"