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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
| Private Sub CommandButton2_Click()
Application.ScreenUpdating = False
Dim ligne1, ligne2, ligne3, ligne4, ligne5, ligne6, ligne7, ligne8 As Long
On Error Resume Next
ligne1 = Application.Match(Me.ComboBox1.Value, Range("A:A"), 0)
On Error Resume Next
ligne2 = Application.Match(Me.ComboBox2.Value, Range("A:A"), 0)
On Error Resume Next
ligne3 = Application.Match(Me.ComboBox3.Value, Range("A:A"), 0)
On Error Resume Next
ligne4 = Application.Match(Me.ComboBox4.Value, Range("A:A"), 0)
On Error Resume Next
ligne5 = Application.Match(Me.ComboBox5.Value, Range("A:A"), 0)
On Error Resume Next
ligne6 = Application.Match(Me.ComboBox6.Value, Range("A:A"), 0)
On Error Resume Next
ligne7 = Application.Match(Me.ComboBox7.Value, Range("A:A"), 0)
On Error Resume Next
ligne8 = Application.Match(Me.ComboBox8.Value, Range("A:A"), 0)
Range("A" & ligne1 & ":AF" & ligne1).Select
Charts.Add
ActiveChart.ChartType = xlLineMarkers
ActiveChart.SetSourceData Source:=Sheets("feuil1").Range("A" & ligne1 & ":AF" & ligne1), PlotBy:=xlRows
ActiveChart.SeriesCollection(1).XValues = "=feuil1!R9C2:R9C32"
ActiveChart.Location where:=xlLocationAsNewSheet
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne2 & ":AF" & ligne2)
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne3 & ":AF" & ligne3)
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne4 & ":AF" & ligne4)
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne5 & ":AF" & ligne5)
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne6 & ":AF" & ligne6)
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne7 & ":AF" & ligne7)
ActiveChart.SeriesCollection.Add _
Source:=Sheets("feuil1").Range("A" & ligne8 & ":AF" & ligne8)
Application.CutCopyMode = False
userform1.Hide
End Sub |
Partager