I have written the below code in VBA to make a line chart with dotted line style and also specific markers for only 1st and last data point. I do not want markers for all data points. In below code ch refers to the chart and variable i refers to series number
With ch.SeriesCollection(i).Format.Line
.transparency = 0
.Style = msoLineSingle
.dashStyle = msoLineRoundDot
.ForeColor.RGB = RGB(0, 0, 0)
End With
' Set markers for the first and last data points
With sC.Points(1)
.MarkerStyle = xlMarkerStyleCircle
.MarkerSize = 5
.Format.Line.Visible = True
.Format.Line.weight = 1.25
If .MarkerStyle <> xlMarkerStyleNone Then
.MarkerBackgroundColor = RGB(255, 255, 255)
End If
.Format.Fill.Visible = False
End With
sC.Points(1).Select
Selection.Format.Line.Visible = msoTrue
Selection.Format.Line.dashStyle = msoLineSolid
With sC.Points(lastPoint)
.MarkerStyle = xlMarkerStyleCircle
.MarkerSize = 5
.Format.Line.Visible = True
.Format.Line.weight = 1.25
If .MarkerStyle <> xlMarkerStyleNone Then
.MarkerBackgroundColor = RGB(255, 255, 255)
End If
.Format.Fill.Visible = False
End With
sC.Points(lastPoint).Select
Selection.Format.Line.Visible = msoTrue
Selection.Format.Line.dashStyle = msoLineSolid
but the above code is making the last portion of the line also as continuous instead of just making the markers with solid line. I managed to get the first marker correct though.
Any pointers on this would be helpful
Shown below is the image
