+ Reply to Thread
Results 1 to 3 of 3

XY (Scatter) chart - 1 series/multiple color

  1. #1
    Registered User
    Join Date
    01-15-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    3

    XY (Scatter) chart - 1 series/multiple color

    Hi All,

    I would like to come up with some VBA code to program conditional color formatting of a series in an XY (Scatter) Chart. I found how to change the color of the markers, but I would also like to have the lines connecting markers in different colors (like in the image).

    Can anyone tell me whether this is possible?

    Thx in advance!XYChart.JPG

  2. #2
    Registered User
    Join Date
    01-15-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: XY (Scatter) chart - 1 series/multiple color

    For info: the code to conditionallay format the markers

    Sub Test()
    Dim cht As Excel.Chart
    Dim pt As Excel.Point

    Set cht = Application.ActiveSheet.ChartObjects(Range("Control!C3").Value).Chart

    For I = 1 To 6

    Set pt = cht.SeriesCollection(1).Points(I)

    pt.MarkerStyle = xlMarkerStyleCircle
    pt.MarkerSize = 8

    If Range("Sheet1!F" & I + 6).Value < 6 Then
    pt.MarkerBackgroundColorIndex = 4
    pt.MarkerForegroundColorIndex = 4
    ' cht.Has.Series.Lines = True
    ' cht.SeriesCollection(1).Border.Color = RGB(0, 255, 0)

    '.Fill.TwoColorGradient msoGradientVertical, 1



    ElseIf Range("Sheet1!F" & I + 6).Value < 31 Then
    pt.MarkerBackgroundColorIndex = 6
    pt.MarkerForegroundColorIndex = 6


    ElseIf Range("Sheet1!F" & I + 6).Value < 51 Then
    pt.MarkerBackgroundColorIndex = 45
    pt.MarkerForegroundColorIndex = 45
    Else
    pt.MarkerBackgroundColorIndex = 3
    pt.MarkerForegroundColorIndex = 3
    cht.SeriesCollection(1).Border.Color = RGB(255, 0, 0)
    End If




    Next


    End Sub

    'ColorIndex
    'Rood = 3
    'Groen = 4
    'Geel = 6
    'Geel = 27
    'Oranje = 45

  3. #3
    Registered User
    Join Date
    01-15-2012
    Location
    Belgium
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: XY (Scatter) chart - 1 series/multiple color

    Hi everybody,

    This post has 79 views, but not a single reply. How can I change this?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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.6.0 RC 1