|
ありがとうございます。
下記で実施しましたらうまくできましたので
再度、挑戦しましたが、やっぱりエラーがでます
ごめんなさい。再度、ご教授ください。
Sub macro()
a = Range(Cells(1, 1), Cells(5, 1))
b = Range(Cells(1, 2), Cells(5, 2))
c = Range(Cells(1, 3), Cells(5, 3))
d = Range(Cells(1, 4), Cells(5, 4))
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:D5"), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = a
ActiveChart.SeriesCollection(1).Values = b
ActiveChart.SeriesCollection(2).XValues = c
ActiveChart.SeriesCollection(2).Values = b
End Sub
Sub 散布図作成()
Dim aRng, bRng, cRng As Range
Dim Hanni As Single
'Q列のデータ入力範囲の行数を数える
Hanni = ActiveSheet.Range("q27", Range("q27").End(xlDown)).Count
With ActiveSheet
Set aRng = .Range("AS27", .Range("P65536").End(xlUp).Offset(Hanni, 31))
Set bRng = .Range("AT27", .Range("P65536").End(xlUp).Offset(Hanni, 32))
Set cRng = .Range("AU27", .Range("P65536").End(xlUp).Offset(Hanni, 33))
End With
ActiveSheet.ChartObjects(2).Activate
ActiveChart.ChartArea.Select
ActiveChart.SetSourceData Source:=ActiveSheet.Range("AS27", Range("P65536").End(xlUp).Offset(Hanni, 33)), PlotBy:=xlColumns
ActiveChart.SeriesCollection(1).XValues = aRng
ActiveChart.SeriesCollection(1).Values = bRng
ActiveChart.SeriesCollection(2).XValues = cRng←ここでエラー
ActiveChart.SeriesCollection(2).Values = bRng
End Sub
|
|