When I used the following lines to adjust the range of a chart:
If EndRow > StartRow Then
ActiveSheet.ChartObjects("EnvGraph").Activate
ActiveChart.SeriesCollection(1).XValues = Range("A" & StartRow & ":A" &
EndRow)
ActiveChart.SeriesCollection(1).Values = Range(Col1(ColNum) & StartRow
& ":" & Col1(ColNum) & EndRow)
ActiveChart.SeriesCollection(2).XValues = Range("A" & StartRow & ":A" &
EndRow)
ActiveChart.SeriesCollection(2).Values = Range(Col2(ColNum) & StartRow
& ":" & Col2(ColNum) & EndRow)
Range("A1").Activate
End If

I got the following run-time error message:
Run-time error '-2147221080 (800401a8)':
Method 'SeriesCollection' of object '_Chart'failed

I suspect that this is due to the use of the sheet.add method:
For i = 1 To InputCaseNum
If RunThisCase(i) = True Then
Sheets.Add Type:=InputTemplate(i)
End If

Because I didn't get the runtime error when I use the Worksheets.Copy method:
Worksheets(InputTemplate(i)).Copy after:=Worksheets(Worksheets.Count)


How could I resolve this problem?