Changing Color of Point on Graph Using VBA Code

  • Thread starter William McNeese
  • Start date
W

William McNeese

Hello,
I have a graph with a number of points on it. Trying to figure out how
color works. I want to change one point to red. I recorded the code below,
but when I re-run it, it doesn't change the color. Any ideas? Thanks.

Bill


ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(1).Points(7).Select
With Selection.Border
.Color = RGB(0, 0, 212)
.LineWeight = 1
.LineStyle = xlContinuous
.Transparency = 0
End With
With Selection
.MarkerBackgroundColor = RGB(255, 0, 0)
.MarkerForegroundColor = RGB(255, 0, 0)
.MarkerStyle = xlSquare
.MarkerSize = 5
.Shadow = True
.MarkerTransparency = 0
End With
ActiveChart.SeriesCollection(3).Select
End Sub
 
J

JE McGimpsey

William McNeese said:
Hello,
I have a graph with a number of points on it. Trying to figure out how
color works. I want to change one point to red. I recorded the code below,
but when I re-run it, it doesn't change the color. Any ideas? Thanks.

This works for me with an X-Y scatter chart:

Public Sub try()
With ActiveChart.SeriesCollection(1).Points(7)
.MarkerBackgroundColor = RGB(255, 0, 0)
.MarkerForegroundColor = RGB(255, 0, 0)
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top