1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
Sub selection()
Dim ncol1, ncol2, ncol3, ncol4
Dim graph As Chart
ncol1 = ActiveCell.Column
ncol2 = ncol1 + 1
ncol3 = ncol1 + 2
ncol4 = ncol1 + 6
plage1 = Union(Cells(1, ncol1), Cells(1, ncol3)).EntireColumn.Select
plage2 = Union(Cells(1, ncol1), Cells(1, ncol2)).EntireColumn.Select
plage3 = Union(Cells(1, ncol1), Cells(1, ncol4)).EntireColumn.Select
Set graph = Charts.Add
With graph
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Range(plage1)
End With
ActiveChart.Location where:=xlLocationAsObject, Name:=ActiveSheet.Name
Set graph = Charts.Add
With graph
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Range(plage2)
End With
ActiveChart.Location where:=xlLocationAsObject, Name:=ActiveSheet.Name
Set graph = Charts.Add
With graph
.ChartType = xlXYScatterSmoothNoMarkers
.SetSourceData Source:=Range(plage3)
End With
ActiveChart.Location where:=xlLocationAsObject, Name:=ActiveSheet.Name
End Sub |
Partager