仕事で久々に面倒なエクセルグラフ作業があり、マクロにしたのでメモ
こういうケースは稀だと思うけど、、
折れ線グラフの線をお系列すべて同じ色にするという(^^;
以下一部抜粋
グラフ追加
ActiveSheet.Shapes.AddChart.Select
折れ線グラフにする
ActiveChart.ChartType = xlLine
X,Y軸入れ替え
ActiveChart.PlotBy = xlRows
系列の数を取得し、各系列に指定した色などを設定していく
iCount = ActiveChart.SeriesCollection.Count
For i = 1 To iCount
ActiveChart.SeriesCollection(i).Select
'マーカー○、サイズ2
With Selection
.MarkerStyle = 8
.MarkerSize = 2
End With
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 112, 192)
.Solid
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 112, 192)
End With
〜等必要な処理〜
Next i
マクロは、あらかじめ操作をマクロで記録して組み立てていくのが楽ですね。余分なコードありそうですが。。。
環境
office 2010
VBA 7.0
こういうケースは稀だと思うけど、、
折れ線グラフの線をお系列すべて同じ色にするという(^^;
以下一部抜粋
グラフ追加
ActiveSheet.Shapes.AddChart.Select
折れ線グラフにする
ActiveChart.ChartType = xlLine
X,Y軸入れ替え
ActiveChart.PlotBy = xlRows
系列の数を取得し、各系列に指定した色などを設定していく
iCount = ActiveChart.SeriesCollection.Count
For i = 1 To iCount
ActiveChart.SeriesCollection(i).Select
'マーカー○、サイズ2
With Selection
.MarkerStyle = 8
.MarkerSize = 2
End With
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 112, 192)
.Solid
End With
With Selection.Format.Line
.Visible = msoTrue
.ForeColor.RGB = RGB(0, 112, 192)
End With
〜等必要な処理〜
Next i
マクロは、あらかじめ操作をマクロで記録して組み立てていくのが楽ですね。余分なコードありそうですが。。。
環境
office 2010
VBA 7.0















