PC Review


Reply
Thread Tools Rate Thread

Determine real colour of automatic line colours?

 
 
=?Utf-8?B?RHVuY2FuTA==?=
Guest
Posts: n/a
 
      18th Oct 2007
I am creating a chart and adding trendlines via VBA - which is all working
marvellously.

Each series is assigned a colour automatically. What I'd like to achieve is
to set the related trendline to be a darker version of the line colour.
However I can't see a way of finding the colour assigned to the series (which
are set as xlAutomatic by Excel)

Is this possible? Or will I have to manage the colours of the series and
trends myself?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      18th Oct 2007
I recorded a macro while manually changing the trend line color. this is
what I got.

Sub Macro1()
'
' Macro1 Macro
' Macro recorded 10/18/2007 by Joel
'

'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Trendlines(1).Select
ActiveChart.SeriesCollection(1).Trendlines(1).Select
With Selection.Border
.ColorIndex = 4
.Weight = xlMedium
.LineStyle = xlContinuous
End With
End Sub


"DuncanL" wrote:

> I am creating a chart and adding trendlines via VBA - which is all working
> marvellously.
>
> Each series is assigned a colour automatically. What I'd like to achieve is
> to set the related trendline to be a darker version of the line colour.
> However I can't see a way of finding the colour assigned to the series (which
> are set as xlAutomatic by Excel)
>
> Is this possible? Or will I have to manage the colours of the series and
> trends myself?

 
Reply With Quote
 
=?Utf-8?B?RHVuY2FuTA==?=
Guest
Posts: n/a
 
      18th Oct 2007
> I recorded a macro while manually changing the trend line color. this is
> what I got.


Thanks for the help, but I know how to change the colours; the question
is how to find out the actual colour assigned to a series that has its
ColorIndex property set as xlAutomatic. I could then use that information to
calculate a darker colour and assign that to the associated trendline colour.

I've gone for manually assigning known colours to the series and trendlines,
from an array that I have set up initially, so it's now more of a question
out of curiosity, but it would be nice to know.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to colour different parts of an object with different colours =?Utf-8?B?Y29sb3VyaW5nIGRpZmZlcmVudCBwYXJ0cyBpbiBh Microsoft Powerpoint 1 28th Sep 2006 04:19 AM
How do I set automatic alternate line colour in a table? =?Utf-8?B?Q3J5c3RhbA==?= Microsoft Access 2 7th Mar 2006 03:18 PM
Colour formatting with spacific colours Derek Brown Microsoft Access Reports 4 24th Jun 2005 02:00 AM
Adding colours to colour selectors Merlin Microsoft VB .NET 0 7th Mar 2004 09:07 PM
need help on colour changing, colours do not change Louise Microsoft Powerpoint 1 9th Sep 2003 02:40 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:45 AM.