Solved

Excel VBA approach to color a segment in a line chart

Posted on 2011-03-19
4
642 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:
teylyn 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 41

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 41

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 41

Author Closing Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Drop Down List with Unique/Distinct Values (enhancing the Combo-Box with a few steps and a little code) David miller (dlmille) Intro Have you ever created a data validation list from a database field or spreadsheet column (e.g., Zip Codes or Co…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

746 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now