Change Pie Chart data point colors

plannett

New Member
Joined
Sep 15, 2009
Messages
6
Hello,
I would like to specify the color for a pie slice in the major items in a pie chart.
I am somewhat of a novice with VBA but I can work my way along. I have three pie charts. Each pie chart lists the top 6 categories. In two or three of the pie charts the 4 out of the six categories are the same. I would like to make sure they are the same color.
How do I go about doing this?
If I can specify RGB in excell and use cell reference for color that would be great.
However, I'm open to however I can specify the colors for the categories, VBA or not.
An example below of my data structure.

Thanks,
Plannett

<TABLE style="WIDTH: 270pt; BORDER-COLLAPSE: collapse" border=0 cellSpacing=0 cellPadding=0 width=360><COLGROUP><COL style="WIDTH: 58pt; mso-width-source: userset; mso-width-alt: 2816" width=77><COL style="WIDTH: 68pt; mso-width-source: userset; mso-width-alt: 3328" width=91><COL style="WIDTH: 48pt" span=3 width=64><TBODY><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; WIDTH: 58pt; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" height=17 width=77></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; WIDTH: 68pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" width=91></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl64 width=64>R</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl64 width=64>G</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; WIDTH: 48pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl64 width=64>B</TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 1</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>404</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 2</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>25</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 3</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>355</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 4</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>80</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 5</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>76</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 6</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>51</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 7</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>23</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 8</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>33</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 9</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>28</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 10</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>60</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 11</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>39</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 12</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>199</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 13</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>20</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 14</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>20</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 15</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>10</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 16</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>3</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 17</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>20</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 18</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>12</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 19</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>2</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 20</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>11</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 21</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>0</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 22</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>1</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 23</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>8</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 24</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>20</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR><TR style="HEIGHT: 12.75pt" height=17><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; HEIGHT: 12.75pt; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl63 height=17>Category 25</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65>0</TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2" class=xl65></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD><TD style="BORDER-BOTTOM: #e2e2e2; BORDER-LEFT: #e2e2e2; BACKGROUND-COLOR: transparent; BORDER-TOP: #e2e2e2; BORDER-RIGHT: #e2e2e2"></TD></TR></TBODY></TABLE>
 

pbornemeier

Well-known Member
Joined
May 24, 2005
Messages
3,720
This code will examine any number of pie charts on the same worksheet and make the data slice with the labels "a", "b", "c", "d", "e" have the same colorindex on each of the pie charts.

The SetWorkbookColors subroutine allows the 56 workbook colors to be specified it is called by the main subroutine.

Recommend that the ResetWorkbookColors be called before the workbook is closed.

Code:
Option Explicit

Sub ColorPieCharts()
    
    Dim iX As Integer
    Dim iY As Integer
    Dim bHasDataLabels As Boolean
    Dim bShowSeriesName As Boolean
    Dim bShowCategoryName As Boolean
    Dim bShowValue As Boolean
    Dim bShowPercentage As Boolean
    Dim bLegendKey As Boolean
    Dim bHasLeaderLines As Boolean
    
    SetWorkbookColors
    
    For iX = 1 To ActiveSheet.ChartObjects.Count
        ActiveSheet.ChartObjects(iX).Select
        
        'Determine DataLabel status
        On Error Resume Next
        bHasDataLabels = ActiveChart.SeriesCollection(1).HasDataLabels
        'bLegendKey = ActiveChart.SeriesCollection(1).LegendKey
        bHasLeaderLines = ActiveChart.SeriesCollection(1).HasLeaderLines
        bShowSeriesName = ActiveChart.SeriesCollection(1).DataLabels.ShowSeriesName
        bShowCategoryName = ActiveChart.SeriesCollection(1).DataLabels.ShowCategoryName
        bShowValue = ActiveChart.SeriesCollection(1).DataLabels.ShowValue
        bShowPercentage = ActiveChart.SeriesCollection(1).DataLabels.ShowPercentage
        On Error GoTo 0
        
        ActiveChart.ApplyDataLabels AutoText:=True, _
            HasLeaderLines:=True, ShowSeriesName:=False, ShowCategoryName:=True, _
            ShowValue:=False, ShowPercentage:=False, ShowBubbleSize:=False
            
        For iY = 1 To ActiveChart.SeriesCollection(1).Points.Count
            Select Case ActiveChart.SeriesCollection(1).Points(iY).DataLabel.Text
            Case Is = "a"
                ActiveChart.SeriesCollection(1).Points(iY).Interior.ColorIndex = 1
            Case Is = "b"
                ActiveChart.SeriesCollection(1).Points(iY).Interior.ColorIndex = 2
            Case Is = "c"
                ActiveChart.SeriesCollection(1).Points(iY).Interior.ColorIndex = 3
            Case Is = "d"
                ActiveChart.SeriesCollection(1).Points(iY).Interior.ColorIndex = 4
            Case Is = "e"
                ActiveChart.SeriesCollection(1).Points(iY).Interior.ColorIndex = 5
            Case Is = "f"
                ActiveChart.SeriesCollection(1).Points(iY).Interior.ColorIndex = 6
            Case Else
                'Other groups get no special color
            End Select
        Next
    Next

End_Sub:
    If bHasDataLabels Then
        ActiveChart.ApplyDataLabels AutoText:=True, _
            HasLeaderLines:=True, ShowSeriesName:=bShowSeriesName, ShowCategoryName:=bShowCategoryName, _
            ShowValue:=bShowValue, ShowPercentage:=bShowPercentage, ShowBubbleSize:=False
    Else
        ActiveChart.SeriesCollection(1).HasDataLabels = False
    End If

End Sub

Sub SetWorkbookColors()
    ActiveWorkbook.Colors(1) = RGB(0, 0, 0)
    ActiveWorkbook.Colors(2) = RGB(0, 0, 100)
    ActiveWorkbook.Colors(3) = RGB(0, 100, 0)
    ActiveWorkbook.Colors(4) = RGB(0, 100, 100)
    ActiveWorkbook.Colors(5) = RGB(100, 0, 0)
    ActiveWorkbook.Colors(6) = RGB(100, 0, 100)
End Sub

Sub ResetWorkbookColors()
    ActiveWorkbook.ResetColors
End Sub
 

Forum statistics

Threads
1,082,099
Messages
5,363,129
Members
400,720
Latest member
Pettel

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...
Top