+ Reply to Thread
Results 1 to 2 of 2

Matching row colors with pie chart colors

  1. #1
    Registered User
    Join Date
    02-20-2018
    Location
    Europe
    MS-Off Ver
    2016
    Posts
    1

    Matching row colors with pie chart colors

    I have 9 rows(from 2-10) that fill up the pie chart.

    I have this macro running so that each pie piece matches the color of each row:

    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 <> xl3DPie 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
    However, the last, 9th row, doesn't match the color with the pie piece, it is simply white. How do I rectify that?

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Matching row colors with pie chart colors

    The code works so you need to provide more information. Specifically what is the RGB color of the final cell? Does that cell have conditional formatting applied to it?
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA code to change Excel chart bar colors as per cell colors
    By mchilapur in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-21-2016, 03:29 AM
  2. Changing cells and column chart colors based on cell colors
    By HDeuce in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-03-2016, 11:43 AM
  3. chart colors to match colors in chart
    By ammartino44 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-20-2015, 06:49 PM
  4. Replies: 16
    Last Post: 12-12-2014, 06:19 AM
  5. Replies: 1
    Last Post: 08-01-2014, 10:33 AM
  6. Replies: 12
    Last Post: 07-08-2013, 09:33 AM
  7. Replies: 3
    Last Post: 08-08-2008, 06:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1