0
我正在嘗試將包含多個工作表中的數據的圖表繪製到同一圖表中。因此,每張表格的數據在我的圖表中都是一個單獨的系列。這裏是兩張表的示例代碼:如何使用多個工作表中的數據創建單個圖表
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"
但即時通訊第二系列集合中的「無效參數」錯誤。請幫我解決這個問題。
謝謝!
謝謝!刪除'ActiveChart.SetSourceData'行的作品 – PerlDev5