データ系列書式の一括変更

Visual Basic for Applications

Sub Macro()
  Dim ChartName
  Dim iii As Integer
  Dim MSG As String
  Dim NS As Integer
  ChartName = Array("main")
  For iii = 0 To UBound(ChartName)
    ActiveSheet.ChartObjects(iii + 1).Name = ChartName(iii)
  Next iii
  MSG = "Input Number of Series"
  NS = InputBox(MSG)
  ActiveSheet.ChartObjects(ChartName(0)).Activate 'ここでは"main"のみとし、インデックスはゼロ
  For iii = 1 To NS
    ActiveChart.SeriesCollection(iii).Select
    With Selection
      .MarkerStyle = 8
      .MarkerSize = 5
      .Format.Line.Weight = 0.5
    End With
  Next iii
  ActiveChart.Legend.Select '凡例書式
  Selection.Left = 120
  Selection.Top = 13
  Selection.Width = 300
  Selection.Height = 150
  With Selection.Format.TextFrame2.TextRange.Font
   .NameComplexScript = "Meiryo UI"
   .NameFarEast = "Meiryo UI"
   .Name = "Meiryo UI"
   .Size = 10
   .Bold = msoFalse
  End With
  ActiveChart.Axes(xlValue).TickLabels.Font.Size = 10
  ActiveChart.Axes(xlCategory).TickLabels.Font.Size = 10
End Sub