LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default changing colours on chart series

I am using macros to create 4 charts from the data on one spreadsheet, each
chart (consisting of 2 series) has different colours. Using the coding below
will change the colours after running the macro. When the macro finishes,
Series 2 on each chart is selected. When I click away from the chart the
colour reverts back to the original default colours. Annoyingly it sometimes
does not happen to all four charts, but 3 out of the 4 will be wrong.
I know there is a glitch with pivot table charts, and although the data
originally came from a pivot table, the data I am using has been copied and
pasted as values. Do I need to use the pivot table solution to get my coding
to work properly or is there something wrong with the coding?

Sub ColourReset()
' reset colours of charts
mySheet1 = "Chart1"
myColour1 = 46
myColour2 = 40
ColourCharts
mySheet1 = "Chart2"
myColour1 = 10
myColour2 = 35
ColourCharts
mySheet1 = "Chart3"
myColour1 = 54
myColour2 = 39
ColourCharts
mySheet1 = "Chart4"
myColour1 = 11
myColour2 = 37
ColourCharts

End Sub

Sub ColourCharts()

'
Sheets(mySheet1).Activate
ActiveSheet.ChartObjects(1).Activate
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = myColour1
.Pattern = xlSolid
End With
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
End With
Selection.Shadow = False
Selection.InvertIfNegative = False
With Selection.Interior
.ColorIndex = myColour2
.Pattern = xlSolid
End With
End Sub

--
Thanks, Jill
 
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
Changing Series for a chart drew1987 Excel Programming 6 June 3rd 08 02:25 PM
Changing chart colours using VBA TommoUK Excel Programming 2 February 8th 06 06:59 PM
Changing colours in chart witzman Charts and Charting in Excel 2 May 31st 05 06:58 AM
multiple or changing colours in a data table on an excel chart fo. Kerri Buxton Charts and Charting in Excel 2 December 23rd 04 07:39 PM
changing colours on stacked bar chart sphenisc Excel Programming 1 June 10th 04 03:32 AM


All times are GMT +1. The time now is 02:12 AM.

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"