Hi all,
Looking for some guidance. I'm wondering if anyone knows of any way to edit this VBA code so that it works with cells that are coloured via conditional formatting?
If not, is it possible to bypass this issue (currently, my poor pie chart is now blank!) by using a VBA code to colour in the cells that my pie chart refers to?
Thank you!
Looking for some guidance. I'm wondering if anyone knows of any way to edit this VBA code so that it works with cells that are coloured via conditional formatting?
If not, is it possible to bypass this issue (currently, my poor pie chart is now blank!) by using a VBA code to colour in the cells that my pie chart refers to?
Code:
Sub ColorPies()
Dim cht As ChartObject
Dim i As Integer
Dim vntValues As Variant
Dim s As String
Dim myseries As Series
For Each cht In ActiveSheet.ChartObjects
For Each myseries In cht.Chart.SeriesCollection
If myseries.ChartType <> xlPie Then GoTo SkipNotPie
s = Split(myseries.Formula, ",")(2)
vntValues = myseries.Values
For i = 1 To UBound(vntValues)
myseries.Points(i).Interior.Color = Range(s).Cells(i).Interior.Color
Next i
SkipNotPie:
Next myseries
Next cht
End Sub
Thank you!