Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Changing Series for a chart | Excel Programming | |||
Changing chart colours using VBA | Excel Programming | |||
Changing colours in chart | Charts and Charting in Excel | |||
multiple or changing colours in a data table on an excel chart fo. | Charts and Charting in Excel | |||
changing colours on stacked bar chart | Excel Programming |