Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 80411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:17:54+00:00 2026-05-10T21:17:54+00:00

I have a chart with a series that denotes a large set (1000’s) of

  • 0

I have a chart with a series that denotes a large set (1000’s) of discrete measurements. Some of these are bad measurements and I want to colour the line for the series based on another set of data that describes how accurate the measurements are. Bad measurements should be red and good measurements green and the in between on some kind of gradient from red to yellow to green.

This should be able to be programmed with VBA however I have no idea what to do. Can anyone give me some hints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:17:55+00:00Added an answer on May 10, 2026 at 9:17 pm

    It is easy enough to colour a chart line in VBA. Here are some notes.

    Dim cht  As Chart Dim sc As Series Dim blnBad As Boolean Dim j  j = 85 'RGB orange ' blnBad = False  'This is a chart called Chart 1, it would be possible ' 'to use the charts collection ' Set cht = ActiveSheet.ChartObjects('Chart 1').Chart 'A chart is composed of series of data ... ' For Each sc In cht.SeriesCollection     ' ... that you can iterate through to pick up '     ' the individual data values, or a data range. '     ' Values in this case. '     For i = LBound(sc.Values) To UBound(sc.Values)         ' That can be checked against another set of '         ' values in the range Bad. '         With ActiveSheet.Range('Bad')             ' So, look for the value ... '             Set c = .Find(sc.Values(i), lookat:=xlWhole, LookIn:=xlValues)             ' and if it is found ... '             If Not c Is Nothing Then                 ' ... then set the Bad flag '                 blnBad = True             End If         End With     Next     ' So, this range contains a Bad value '     ' and we will colour it red ... '     If blnBad Then         sc.Border.Color = RGB(255, 0, 0)         ' ... not forgetting the markers '         sc.MarkerForegroundColor = RGB(255, 0, 0)     Else         ' Otherwise, use an increasingly yellow colour '         sc.Border.Color = RGB(255, j, 0)         sc.MarkerForegroundColor = RGB(255, j, 0)          j = j + 30 ' getting more yellow         ' Debug.Print j ' uncomment to see j in the immediate window '     End If     blnBad = False Next End Sub 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code that generates image of a pie chart. It's a general
I have a chart (in bitmap format) that I'm trying to render to a
In the MS Chart control (which they bought from Dundas), I have three series
I have a chart in a Worksheet in Excel and I have a macro
I have to display a column chart in a user form in VBA. Exporting
Does anyone have a list or chart of all MSIL codes and their corresponding
I am developing a web application which has Chart Controls. I have developed a
So, I have a WindowsFormsHost control in my WPF app (hosting a Dundas Chart)
I have a char array in a C application that I have to split
i have problem to correctly bind data to WPF Chart. When i'm setting ItemsSource

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.