Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Menjo
 
Posts: n/a
Default determine colouring of variables of a pie chart

I am using pie charts right now to show the size of marketshare of some
companies within a few countries. It would be usefull if I could give the
different companies in every pie chart their " own" colour. Do you have some
suggestions about the best way to do this?

Kind regards,

Menno
  #2   Report Post  
Jon Peltier
 
Posts: n/a
Default

This macro will recolor the points in a series based on the category
labels. Replace "AAAA" etc. by the names of the companies, and the
numbers by whatever numbers produce the colors you need. You'll need to
experiment a little.

Sub ColorColumns()
Dim iPoint As Long, nPoint As Long
With ActiveSheet.ChartObjects(2).Chart.SeriesCollection (1)
For iPoint = 1 To .Points.Count
Select Case WorksheetFunction.Index(.XValues, iPoint)
Case "AAAA"
.Points(iPoint).Interior.ColorIndex = 6 ' Yellow
Case "BBBB"
.Points(iPoint).Interior.ColorIndex = 5 ' Blue
Case "CCCC"
.Points(iPoint).Interior.ColorIndex = 3 ' Red
Case "DDDD"
.Points(iPoint).Interior.ColorIndex = 13 ' Purple
Case "EEEE"
.Points(iPoint).Interior.ColorIndex = 46 ' Orange
Case "FFFF"
.Points(iPoint).Interior.ColorIndex = 4 ' Green
Case "GGGG"
.Points(iPoint).Interior.ColorIndex = 8 ' Cyan
End Select
Next
End With
End Sub

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Menjo wrote:

I am using pie charts right now to show the size of marketshare of some
companies within a few countries. It would be usefull if I could give the
different companies in every pie chart their " own" colour. Do you have some
suggestions about the best way to do this?

Kind regards,

Menno

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
Activating a Chart object Hari Prasadh Charts and Charting in Excel 6 August 2nd 05 07:22 PM
Urgent Chart Assistance Brent E Charts and Charting in Excel 1 May 10th 05 09:09 AM
Urgent Chart Questions Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM
Urgent Chart Assistance Requested Brent E Excel Discussion (Misc queries) 0 May 9th 05 11:01 PM
Use variables for a chart Fysh Charts and Charting in Excel 4 December 9th 04 08:45 PM


All times are GMT +1. The time now is 08:49 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"