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
| Private Sub CommandButton1_Click()
For Each sh In Sheets("Imp").Shapes
sh.Delete
Next
With ActiveSheet.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) = True Then
[A1] = i + 1
Charts.Add
Set v = ActiveChart
ActiveChart.ChartType = xlLine
ActiveChart.SetSourceData Source:=Sheets("Feuil1 (2)").Range("B4:D6"), _
PlotBy:=xlColumns
ActiveChart.Location Where:=xlLocationAsObject, Name:="Imp"
With ActiveChart
.ChartType = xlLine
.SetSourceData Source:=Sheets("Feuil1 (2)").Range("B3:D6"), _
PlotBy:=xlColumns
.Location Where:=xlLocationAsObject, Name:="Imp"
.HasTitle = True
.ChartTitle.Text = ['feuil1 (2)'!A4].Value
End With
ctr = ctr + 1
Set sh = Sheets("Imp").Shapes(Sheets("Imp").Shapes.Count)
sh.Height = 330
sh.Width = 600
sh.Left = 1
sh.Top = 330 * (ctr - 1)
.Selected(i) = False
End If
Next i
End With
End Sub |
Partager