LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Set color for chart serie in excel 2007/2010

I'm not sure I quite follow. Indeed the code is slightly different to apply
colour to Line or Fill but you say you have already got the code to do that.
The code is also slightly different in 2007+ and earlier versions.

For earlier versions have you considered making a workbook template for all
users with a customized palette. In particular customize the 6th row for
fill colours and the 7th row of 8 for line colours. If you do that all
charts will be automatically applied with your default colours (at least for
the first 8 series).

That approach is not useful in 2007. You can of course apply your own Office
theme. Colours are the same for fills and lines (unlike earlier versions).
Each set of series uses a different shade of them colour.

Another way is to defile your own palette, one way - (this assumes 2007)

- Colour format some cells, at least as many as there will ever be series in
a chart, Ctrl-F1, Fill, More colors..
- Name the coloured cells say "Swatch"

In your code that colours the series start with this

Dim pal() as long
getColors pal

and add this function

Sub getColors(pal() As Long)
Dim i As Long
Dim rng As Range, c As Range
Set rng = ActiveWorkbook.Names("Swatch").RefersToRange
ReDim pal(1 To rng.Count)
For Each c In rng
i = i + 1
pal(i) = c.Interior.Color
Next
End Sub


Do you know know to process each chart on each sheet?

Regards,
Peter T



"Lina" wrote in message
...
The company has a set of color and they dont allow any other colors. I
have done some chart templates with the predifined colors. The problem
is that if a user adds more data to a chart that is allready done the
new serie will not use the color that is saved in the chart template,
it uses the built in colors instead. Do get the right colors you can
apply the chart template again but, if the user has made som settings
for the chart thoose will be overriden by the template. So instead I
would like to have a button "set company color" and that button should
go thru the series and set the color that is allowed by the company. I
would like it to work for all type of charts. I have it working for
bar, line and pie but what if the user has made a bar and a line, is
there a way to get this to work for all chart types or must I treat
each type of serie differently?



 
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
Change gradient color in chart for Excel 2007 NonTechie Charts and Charting in Excel 6 May 9th 23 03:43 AM
Chart issue--works in 2007, not in 2010 tmidgett Charts and Charting in Excel 0 February 8th 11 05:43 PM
Excel 2007 Chart - determining the color of a chart style Shane Devenshire[_2_] Charts and Charting in Excel 1 February 6th 10 04:09 AM
Saving chart templates - xl 2007 (and 2010?) Reg Charts and Charting in Excel 0 January 13th 10 03:36 PM
Excel 2007 chart gridline color using vba [email protected] Charts and Charting in Excel 2 December 17th 08 03:32 PM


All times are GMT +1. The time now is 05:31 PM.

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

About Us

"It's about Microsoft Excel"