我试图录制一个宏,我将更改标记颜色,线条颜色,标记填充。但我录制的所有内容都是
Sub Macro1()
'
' Macro1 Macro
'
ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.SeriesCollection(1).Select
ActiveChart.SeriesCollection(2).Select
End Sub
答案 0 :(得分:4)
这是一种使用变量定义新系列的方法,并设置与其相关的不同参数:
Option Explicit
Sub 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
' Edit #1
.Format.Line.Visible = msoTrue
' Line color red
.Format.Line.ForeColor.RGB = RGB(192, 0, 0)
' marker style
.MarkerStyle = xlMarkerStyleDiamond
' marker size
.MarkerSize = 8
' marker Fill color
.MarkerBackgroundColor = RGB(0, 176, 80) ' Marker Fill color Green
' marker foreground color
.MarkerForegroundColor = RGB(0, 0, 0) ' marker foreground Black (lines around)
End With
End Sub