複数のワークシートのデータを含むグラフを同じグラフにプロットしようとしています。したがって、各シートのデータは、私のグラフでは別々のシリーズになります。2枚のサンプルコードは次のとおりです。
Name1 = ActiveWorkbook.Worksheets(1).Name
Name2 = ActiveWorkbook.Worksheets(2).Name
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlXYScatterSmooth
ActiveChart.ChartArea.Select
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SetSourceData Source:=Range("'" & Name1 & "'!$C$" & nStart & ":$D$" & nLast & "")
ActiveChart.SeriesCollection(1).Name = "=" & Name1 & "!A1"
ActiveChart.SeriesCollection(1).XValues = "='" & Name1 & "'!$C$" & nStart & ":$C$" & nLast & ""
ActiveChart.SeriesCollection(1).Values = "='" & Name1 & "'!$E$" & nStart & ":$E$" & nLast & ""
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SetSourceData Source:=Range("'" & Name2 & "'!$C$" & nStart & ":$D$" & nLast & "")
ActiveChart.SeriesCollection(2).XValues = "='" & Name2 & "'!$C$" & nStart & ":$C$" & nLast & ""
ActiveChart.SeriesCollection(2).Values = "='" & Name2 & "'!$E$" & nStart & ":$E$" & nLast & ""
ActiveChart.SeriesCollection(2).Name = "=" & Name2 & "!A1"
しかし、2番目のシリーズコレクションで「無効なパラメータ」エラーが発生します。これを解決するのを手伝ってください。
ありがとう!