Excel VBA - How do you set line style for chart series?

后端 未结 3 1475
半阙折子戏
半阙折子戏 2021-01-21 04:17

I would like the plot lines in a chart to be either solid, circle dot, or square dot based upon a certain criteria specified by the user. I can successfully set the line color

3条回答
  •  甜味超标
    2021-01-21 04:33

    Create a chart with 255 data series, run the code (and do other formatting as necessary). Then save it as a template.

    Sub dd()
    
    Dim wb As Workbook
    Set wb = Application.ActiveWorkbook
    
    Dim myChart As Chart
    Set myChart = wb.Charts("Chart5")
    
    Dim mySeries As series
    
    For Each mySeries In myChart.SeriesCollection
        mySeries.Format.Line.Weight = 1#
    Next
    
    End Sub
    

提交回复
热议问题