LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Naz Naz is offline
external usenet poster
 
Posts: 85
Default Chart slice colours....almost works

Hi,

I want to create a little macro that automatically changes the colours of
each slice in a chart to a pre-defined colour. I can't create a pre-defined
user chart for various network reasons. So far I have the following long
winded, but easy for me to understand code, but the case select module where
the colours are selected doesn't work, i've only had a rough guess as to how
it should work, and if you can do a case select for chart slices, so i may be
well out.

Sub ChartColours()

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Select
Slice = 1

On Error Resume Next

For x = 1 To 20 ' Im going to assume no more than 20 slices

ActiveChart.SeriesCollection(1).Points(Slice).Sele ct
Module1.SelectionFill
Module1.SliceColour

Slice = Slice + 1

Next x

End Sub

Private Sub SelectionFill()

Selection.Fill.OneColorGradient Style:=msoGradientDiagonalUp,
Variant:=2, _
Degree:=0.231372549019608

End Sub

Private Sub SliceColour()

SelSlice = Chart.SeriesCollection(1).Points <<< I'm stuck at
this point

Select Case SelSlice

Case 1
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 1
End With

Case 2
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 2
End With

Case 3
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 3
End With

Case 4
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 4
End With

Case 5
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 5
End With

End Select


End Sub


Any help to get it working would be greatly appreciated, help to make it
work and more efficient would be even more appreciated !


regards
--

_______________________
Naz,
London
 
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
Extra Slice in Pie in Pie chart unekme Charts and Charting in Excel 4 April 28th 08 07:43 PM
Changing pie chart slice colors John Charts and Charting in Excel 1 March 2nd 08 07:48 PM
Pie Chart with other charts representing each slice Tammy Charts and Charting in Excel 2 January 10th 08 03:24 PM
Pie Chart - "Other" Slice WaY Excel Discussion (Misc queries) 2 July 23rd 05 08:10 AM
break a slice up in my pie chart into sub-catagories aliann Charts and Charting in Excel 1 June 22nd 05 10:14 AM


All times are GMT +1. The time now is 04:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"