Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Pie Chart Colors

I have a simple table with three columns

1. Title
2. Value
3. Color

With data like
B 8 Blue
J 5 Yellow
V 12 Green

How can I using vba set the color for each pie chart segment based on the
specified color from the respective data from the color column. So the slice
representing B (8) would be blue and the J (5) would be yellow, etc.

Thank you

QB
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Pie Chart Colors

Format your "color" cells with colours from the drop-down Fill color
palette. In the following change rngFirstClrCell = to suit

Sub test()
Dim n As Long
Dim cht As Chart
Dim pt As Point
Dim rFirstClrCell As Range

Set rFirstClrCell = Range("C3") ' << CHANGE

Set cht = ActiveChart
If cht Is Nothing Then
MsgBox "Select a chart"
Exit Sub
End If

For Each pt In cht.SeriesCollection(1).Points
pt.Fill.ForeColor.SchemeColor = _
rFirstClrCell.Offset(n, 0).Interior.ColorIndex
n = n + 1
Next

End Sub

Regards,
Peter T


"Question Boy" wrote in message
...
I have a simple table with three columns

1. Title
2. Value
3. Color

With data like
B 8 Blue
J 5 Yellow
V 12 Green

How can I using vba set the color for each pie chart segment based on the
specified color from the respective data from the color column. So the

slice
representing B (8) would be blue and the J (5) would be yellow, etc.

Thank you

QB



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
Chart Colors Leirikello Charts and Charting in Excel 2 August 18th 09 09:51 PM
Bar Chart colors less than zero ORLANDO VAZQUEZ Excel Discussion (Misc queries) 2 January 28th 09 09:25 PM
How can I show different bar colors in the same chart? Tee Ransone Charts and Charting in Excel 2 February 11th 06 02:17 PM
static colors in chart chart Johan Charts and Charting in Excel 1 September 22nd 05 01:01 PM
chart default colors wendyeyes Charts and Charting in Excel 1 July 30th 05 04:21 PM


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

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"