Share via

Line color doesnt change while changing using vba

Anonymous
2016-08-25T16:18:48+00:00

I used the below code to change the line color in vbaSub Macro1()

Dim Cht_Series As Series

ActiveSheet.ChartObjects("Chart 1").Activate

Set Cht_Series = ActiveChart.SeriesCollection(1)

With Cht_Series
    ' line weight
    .Format.Line.Weight = 1

    ' Line color Green
    .Format.Line.ForeColor.RGB = RGB(0, 176, 80)   ' Line color green

End With

But it's not working. When I changed to .Format.Fill.Forecolor, it's working perfectly by changing the marker fill color

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2016-08-25T23:15:00+00:00

    Your code works for me (in Excel 2013).

    Try it on a fresh chart in a fresh workbook.

    If it works there's something odd about the original chart

    If it doesn't there's something odd about your Excel.

    Was this answer helpful?

    0 comments No comments