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 57
| Option Compare Text
Private Sub Worksheet_Change(ByVal Target As Range)
Application.ScreenUpdating = False
If Target.Address = "$A$13" Then
GRAPH = 2
RR = 14
'***********************CHANGEMENT DES AXES "X"***********************
'EFFACE les anciennes données des 3 colonnes
Application.EnableEvents = False
COL1 = 14
COL2 = 16
COL3 = 18
COL_X = 7
Range(Cells(4, 14), Cells(1000000, 14)).ClearContents
Range(Cells(4, 16), Cells(1000000, 16)).ClearContents
Range(Cells(4, 18), Cells(1000000, 18)).ClearContents
'Recupère les données des 3 courbes
For G = 1 To 3
With Sheets("Donnees_Graphe_Pick_Up_1_" & G)
.Select
DL = .Range("A1048576").End(xlUp).Row
.Range(.Cells(1, Cells(2, 14).Value), .Cells(DL, Cells(2, 14).Value)).Select
End With
Selection.Copy
Sheets("Graphe_01").Select
If G = 1 Then
Cells(4, 14).Select
ElseIf G = 2 Then
Cells(4, 16).Select
Else
Cells(4, 18).Select
End If
ActiveSheet.Paste
Range("B10").Select
Next G
Application.EnableEvents = True
ActiveSheet.ChartObjects("Graphique " & GRAPH).Activate
ActiveChart.PlotArea.Select
DL = Cells(1048576, 14).End(xlUp).Row
ActiveChart.FullSeriesCollection(1).XValues = "=Graphe_01!R6C14:R" & DL & "C14"
DL = Cells(1048576, 16).End(xlUp).Row
ActiveChart.FullSeriesCollection(2).XValues = "=Graphe_01!R6C16:R" & DL & "C16"
DL = Cells(1048576, 18).End(xlUp).Row
ActiveChart.FullSeriesCollection(3).XValues = "=Graphe_01!R6C18:R" & DL & "C18"
ActiveChart.Axes(xlCategory).Select
ActiveChart.Axes(xlValue).TickLabels.NumberFormatLinked = -1 ' équivaut à cocher "lier à la source"
Range("A1").Select
End If
End Sub |
Partager