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