Hello
Im very new to all this so sorry if i haven't come across correct.
I have a macro that changes my chart colors basted on the conditional formatting of of a cell.
the problem i have is that i have to run the macro manually and i would like it to work automatically soon as the cell connected with chart changes color the chart updates and matches the colour.
THE CODE (a very kind person done for me)
Im very new to all this so sorry if i haven't come across correct.
I have a macro that changes my chart colors basted on the conditional formatting of of a cell.
the problem i have is that i have to run the macro manually and i would like it to work automatically soon as the cell connected with chart changes color the chart updates and matches the colour.
THE CODE (a very kind person done for me)
Code:
Sub colourTheCharts()
Dim co As ChartObject
Dim sourceData As Range
Dim n As Long
Dim ser As Series
Dim seriesFormula As String
For Each co In ActiveSheet.ChartObjects
Set ser = co.Chart.SeriesCollection(1)
seriesFormula = Mid$(ser.Formula, 10)
seriesFormula = Left$(seriesFormula, InStr(seriesFormula, ",") - 1)
Set sourceData = Application.Range(seriesFormula)
For n = 1 To ser.Points.Count
With ser.Points(n).Format.Fill
.Visible = True
.Solid
.ForeColor.RGB = sourceData.Cells(n).DisplayFormat.Interior.Color
End With
Next n
Next
End Sub
Last edited by a moderator: