Quantcast
Channel: Active questions tagged excel - Stack Overflow
Viewing all articles
Browse latest Browse all 88835

VBA Change Sourcedata Line Color

$
0
0

Trying to change the line of my fullseries sourcedata rangey3.

I tried using:

.Format.Line.ForeColor.RGB = RGB(56, 182, 75)
.MarkerBackgroundColor = RGB(56, 182, 75)

to no avail but it does work for the forecasted values.

My code is:

ActiveSheet.Shapes.AddChart2(332, xlLineMarkers).Select
With ActiveChart
.SetSourceData Source:=rangey3
' Must have this as we will be using different series inside of this chart from here on out
.FullSeriesCollection(1).Name = "Demand"' This is the first series of the full series collection
.SeriesCollection(1).XValues = rangex
.SeriesCollection.NewSeries
' Creates legend at the bottom of the chart
.SetElement (msoElementLegendBottom)
' Deletes the chart title as per the illustration in Assignment 2's illustration screenshot
.ChartTitle.Delete

' Creates the line Demand (Forecast)
With .SeriesCollection(2)
    .Name = "Demand (Forecast)"
    .Values = rangey2
    .Format.Line.Visible = msoTrue
    ' Makes the forecast line distinguishable by dotting it
    .Format.Line.DashStyle = msoLineSysDot
    .Format.Line.ForeColor.RGB = RGB(56, 182, 75)
    .MarkerBackgroundColor = RGB(56, 182, 75)
End With

Viewing all articles
Browse latest Browse all 88835

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>