Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extra Slice in Pie in Pie chart | Charts and Charting in Excel | |||
Changing pie chart slice colors | Charts and Charting in Excel | |||
Pie Chart with other charts representing each slice | Charts and Charting in Excel | |||
Pie Chart - "Other" Slice | Excel Discussion (Misc queries) | |||
break a slice up in my pie chart into sub-catagories | Charts and Charting in Excel |