0
Excelのスプレッドシートの別のタブにあるチャートにデータポイントを追加しようとしていますが、現在チャートページを開いているときに追加しますが、他のタブに、アドバイスはありますか?別のワークシートのチャートにデータポイントを追加する
Sub Submit()
Dim Well_Outage As Long
Dim DP As Double
Dim i As Long
Dim j As Long
Dim myDocument As Worksheet
'Dim graph As Worksheet
Set myDocument = Worksheets(2)
Set graph = Worksheets
j = ActiveChart.SeriesCollection.Count
If myDocument.Cells(19, "I") = "" And myDocument.Cells(20, "I") = "" Then
MsgBox ("Enter Drilling and Production Lost Times")
Exit Sub
ElseIf myDocument.Cells(19, "I") = "" Then
MsgBox ("Enter Drilling Lost Times")
Exit Sub
ElseIf myDocument.Cells(20, "I") = "" Then
MsgBox ("Enter Production Lost Times")
Exit Sub
End If
i = 1
Well_Outage = myDocument.Cells(17, "L")
DP = (myDocument.Cells(19, "I")/myDocument.Cells(20, "I"))
DP = Round(DP, 1)
myDocument.Range("L6:L16").Value = "N"
myDocument.Range("I19:I20").Value = ""
Do While Not (myDocument.Cells(i, 1) = "")
i = i + 1
Loop
Do While Not (myDocument.Cells(i, 2) = "")
i = i + 1
Loop
myDocument.Cells(i, 1).Value = DP
myDocument.Cells(i, 2).Value = Well_Outage
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(j).XValues = (myDocument.Cells(i, 1))
ActiveChart.FullSeriesCollection(j).values = (myDocument.Cells(i, 2))
ActiveChart.ChartArea.Select
ActiveChart.FullSeriesCollection(j).Select
With Selection
.MarkerStyle = 8
.MarkerSize = 5
End With
Selection.MarkerStyle = -4168
Selection.MarkerSize = 6
Selection.MarkerSize = 7
Selection.MarkerSize = 8
Selection.MarkerSize = 9
Selection.MarkerSize = 10
With Selection.Format.line
.Visible = msoTrue
.weight = 2
End With
With Selection.Format.line
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = 0
.Transparency = 0
End With
With Selection.Format.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorText1
.ForeColor.TintAndShade = 0
.Transparency = 0
.Solid
End With
Selection.Format.Fill.Visible = msoFalse
End Sub