+ Reply to Thread
Results 1 to 5 of 5

Why does this macro color the series on the chart but not the legend, for non-pie charts?

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Why does this macro color the series on the chart but not the legend, for non-pie charts?

    The purpose of the following code is to change the colors of the series in a chart according to the colors of cells with the values. It was originally made for Pie charts and it works for those.

    I don't understand most of the code, but I noticed that there's a line in it in order to skip all charts which are not pie. I put that line in comment because I want to use this macro for a stacked column chart. However the problem is that it only changed the colors of the columns, but not the legend. (the legend has the same color as before which doesn't fit the new color of the columns)

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by tahi.laci; 11-08-2015 at 07:11 AM. Reason: solved

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Why does this macro color the series on the chart but not the legend, for non-pie char

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Registered User
    Join Date
    04-16-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Why does this macro color the series on the chart but not the legend, for non-pie char

    I've included a sheet before the macro runs and one after. I added an extra pie chart to show how the legend would look if it was done correctly. The legend of the column chart should have the same colors as the legend of the pie chart. Order doesn't matter.

  4. #4
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Why does this macro color the series on the chart but not the legend, for non-pie char

    Try this.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    04-16-2013
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: Why does this macro color the series on the chart but not the legend, for non-pie char

    Thanks that worked. And probably the previous advice about the sample workbook was good as well.

    Can you point to me a website where I can learn about these type of macros? (macros containing object & series type variables). Ideally they would have a few examples of what other objects there are other than ChartObject and a few examples of characteristics we can read and write. (eg .Interior.Color, .forecolor.RGB)

+ 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] Series name in columns - getting them to be the legend on a chart
    By davidx in forum Excel General
    Replies: 1
    Last Post: 09-03-2014, 11:38 AM
  2. need to remove #N/A from chart legend series
    By plabh in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 06-27-2013, 01:35 AM
  3. Set chart series color to match series legend entries font color
    By Equipoise in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2013, 07:33 AM
  4. Legend for scatter charts with color coded data points
    By Bernadine in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-26-2012, 10:32 AM
  5. Replies: 0
    Last Post: 06-07-2012, 11:09 AM
  6. [SOLVED] Exclude one data series from scatter chart legend (but not from the chart)
    By JayUSA in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 05-29-2012, 05:24 PM
  7. Series order in a chart legend.
    By Phil in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 09-28-2005, 04:05 PM

Tags for this Thread

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