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 |
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 |
All times are GMT +1. The time now is 07:47 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com