Solved

Excel VBA approach to color a segment in a line chart

Posted on 2011-03-19
4
651 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Introduction This Article is a follow-up to my Mappit! Addin Article (http://www.experts-exchange.com/A_2613.html), it was inspired by an email posting I made to EUSPRIG (http://www.eusprig.org/index.htm), I will briefly cover: 1) An overvie…
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…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

828 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