|
んー・・それはおかしいですね。では、これでどうでしょーか ?
Sub MyChart1()
Dim Ch As ChartObject, MyCh As ChartObject
Dim Lp As Single, Wp As Single, Hp As Single
Dim i As Integer, j As Integer
With ActiveSheet
If .ChartObjects.Count > 0 Then
For Each Ch In .ChartObjects
If Ch.TopLeftCell.Address = "$A$1" Then
Ch.Delete
End If
Next
End If
With .Range("A1:L9")
Lp = .Left + 11
Wp = .Width - 10
Hp = .Height - 10
End With
Set MyCh = .ChartObjects.Add(Lp, 0, Wp, Hp)
MyCh.Chart.ChartType = xlLine
For i = 49 To 53
If Not IsEmpty(.Cells(i, 2).Value) Then
j = j + 1
MyCh.Chart.SeriesCollection.NewSeries _
.Formula = "=SERIES(," & .Name & "!$A$48:$K$48," & _
.Name & "!$A$" & i & ":$K$" & i & "," & j & ")"
End If
Next i
MyCh.Chart.HasTitle = True
MyCh.Chart.ChartTitle.Text = .Range("A47").Value
End With
With MyCh.Chart.ChartTitle
.Font.Size = 15
.Border.ColorIndex = 5
End With
With MyCh.Axes(xlCategory)
.HasTitle = True
.AxisTitle.Text = "日付"
.AxisTitle.Font.Size = 12
End With
With MyCh.Axes(xlValue)
.HasTitle = True
.AxisTitle.Text = "データ2"
.AxisTitle.Font.Size = 14
End With
Set MyCh = Nothing
End Sub
|
|