+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Custom Coloring an area chart with VBA

    For the life of me I can not find the attributes for coloring a data series in an xlAreaStacked chart.

    Code:
      Charts.Add
        ActiveChart.SetSourceData Source:=Range("E3").Resize(4, DateOffset + 1)
        ActiveChart.SeriesCollection(1).XValues = Range("F1").Resize(1, DateOffset + 1)
        ActiveChart.ChartGroups(1).GapWidth = 0
        ActiveChart.ChartType = xlAreaStacked
    I'm quite sure it's something like:

    ActiveChart.ChartType.DataSeries(1).Color = "#FFFFFF"

    but it seems suspiciously and strangely impossible a piece of information to find.

    Thanks for any help.
    Last edited by mattdick; 06-05-2009 at 07:23 PM.

  2. #2
    Forum Contributor starryknight64's Avatar
    Join Date
    09-27-2006
    Location
    Missouri
    MS-Off Ver
    2003 (Work) & 2007 (Home)
    Posts
    193

    Re: Custom Coloring an area chart with VBA

    Try this out:

    Code:
    ActiveChart.SeriesCollection(1).Interior.ColorIndex = 32
    starryknight64

  3. #3
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Custom Coloring an area chart with VBA

    Super, you rock.

    I used that as a keyword which finally led me to intelligible discussions of excel color and found that ColorIndex is the less subtle cousin of Color, which I am now using:

    Code:
    ActiveChart.SeriesCollection(1).Interior.Color = "#FF0088"
    Thanks!

  4. #4
    Forum Contributor starryknight64's Avatar
    Join Date
    09-27-2006
    Location
    Missouri
    MS-Off Ver
    2003 (Work) & 2007 (Home)
    Posts
    193

    Re: Custom Coloring an area chart with VBA

    Awesome! Glad I could help.

    I assume this is solved now?
    starryknight64

  5. #5
    Registered User
    Join Date
    04-28-2009
    Location
    Chicago, IL, USA
    MS-Off Ver
    Excel 2007
    Posts
    31

    Re: Custom Coloring an area chart with VBA

    Yes, totally solved. I am using Color instead of ColorIndex, but you helped me find the real resource I needed.

Thread Information

Users Browsing this Thread

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

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.2.0