Solved

Excel VBA approach to color a segment in a line chart

Posted on 2011-03-19
4
654 Views
Last Modified: 2012-05-11
I know how to color the whole line, and I have a routine that enumerates the points.  What is the property I can update to change a single segment at a certain point in a line chart?

Dave
0
Comment
Question by:dlmille
  • 3
4 Comments
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 500 total points
ID: 35173397
Hello,

which version of Excel?

In 2010 you can use something along these lines (formats the 3rd data point of the first series, change to suit)

    With ActiveChart.SeriesCollection(1).Points(3).Format.Line
        .Visible = msoTrue
        .ForeColor.ObjectThemeColor = msoThemeColorAccent3
        .ForeColor.TintAndShade = 0
        .ForeColor.Brightness = 0
        .Transparency = 0
    End With

Open in new window


cheers, teylyn
0
 
LVL 42

Author Comment

by:dlmille
ID: 35173552
Version 2007.

Thanks for pointing me to what I should have found in the object.

I'm not sure themecolor is correct as when I test this its zero for a chart where I've manually colored the segments.

SchemeColor, however has values.  I'm trying to relate a set of cells that are colored with the chart line segments.  What's the relationship with
a range.interior.color or .colorindex with schemecolor (or other related color property I should be using)?

Thanks,

Dave
0
 
LVL 42

Assisted Solution

by:dlmille
dlmille earned 0 total points
ID: 35173562
Got it - I just remembered + 7 on schemecolor will match a range.interior.colorindex color.

Thanks!

Dave
0
 
LVL 42

Author Closing Comment

by:dlmille
ID: 35205138
Accurate enough for me to get to the correct property I needed...
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Convert between Excel file formats (.XLS, .XLSX, .XLSM) with/without macro option David Miller (dlmille) Intro Over this past Fall, I've had the opportunity to see several similar requests and have developed a couple related solutions associate…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question