Application.ScreenUpdating = False
Dim cht As Object, i, x, n As Integer
Set cht = ActiveSheet.Shapes.AddChart
cht.Select
For i = 1 To 5
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(i).Name = Range(Cells(ActiveCell.Row + 16, ActiveCell.Column + 2 * x), Cells(ActiveCell.Row + 16, ActiveCell.Column + 2 * x))
ActiveChart.SeriesCollection(i).Values = Range(Cells(ActiveCell.Row + 17, ActiveCell.Column + 2 * x + 1), Cells(ActiveCell.Row + 40, ActiveCell.Column + 2 * x + 1))
ActiveChart.SeriesCollection(i).XValues = Range(Cells(ActiveCell.Row + 17, ActiveCell.Column + 2 * x), Cells(ActiveCell.Row + 40, ActiveCell.Column + 2 * x))
Cells(ActiveCell.Row + 16, ActiveCell.Column + 2 * x).Interior.Color = RGB(220, 230, 241)
x = x + 1
Next
cht.Chart.ChartType = xlLine
ActiveChart.Parent.Cut
ActiveSheet.Paste
Application.ScreenUpdating = True |