現在、このマクロを使用して、別のシートから値を取得するグラフを生成しています。シート1が検出されず、列Aに入力がない場合にシリーズの追加を停止して、これを単純化するにはどうすればよいですか.
ActiveSheet.ChartObjects("CH 1").Activate
ActiveChart.SeriesCollection.NewSeries.MarkerStyle = False
ActiveChart.SeriesCollection(1).Name = "='Sheet1'!$A$2"
ActiveChart.SeriesCollection(1).Values = "='data'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(2).Name = "='Sheet1'!$A$3"
ActiveChart.SeriesCollection(2).Values = "='data (2)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(3).Name = "='Sheet1'!$A$4"
ActiveChart.SeriesCollection(3).Values = "='data (3)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).Name = "='Sheet1'!$A$5"
ActiveChart.SeriesCollection(4).Values = "='data (4)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(5).Name = "='Sheet1'!$A$6"
ActiveChart.SeriesCollection(5).Values = "='data (5)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(6).Name = "='Sheet1'!$A$7"
ActiveChart.SeriesCollection(6).Values = "='data (6)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(7).Name = "='Sheet1'!$A$8"
ActiveChart.SeriesCollection(7).Values = "='data (7)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(8).Name = "='Sheet1'!$A$9"
ActiveChart.SeriesCollection(8).Values = "='data (8)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(9).Name = "='Sheet1'!$A$10"
ActiveChart.SeriesCollection(9).Values = "='data (9)'!$B$2:$B$400"
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(10).Name = "='Sheet1'!$A$11"
ActiveChart.SeriesCollection(10).Values = "='data (10)'!$B$2:$B$400"