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
|
Sub Macro1()
Dim Var As String, Tabl, Feuille As String
ActiveSheet.ChartObjects(1).Activate
Var = ActiveChart.SeriesCollection(1).Formula
Tabl = Split(Var, ",")
pos_elt = UBound(Tabl) - 1
ReDim Preserve Tabl(pos_elt + 2)
Tabl(pos_elt + 2) = Tabl(pos_elt + 1)
Feuille = Left(Tabl(2), InStr(1, Tabl(2), "!") - 1)
Tabl(pos_elt) = Left(Tabl(pos_elt), Len(Tabl(pos_elt)) - 1)
Tabl(pos_elt + 1) = Feuille & "!" & Range(Tabl(pos_elt)).Offset(0, 2).Address & ")"
Var = Join(Tabl, ",")
ActiveChart.SeriesCollection(1).Formula = Var
Var = ActiveChart.SeriesCollection(2).Formula
Tabl = Split(Var, ",")
pos_elt = UBound(Tabl) - 1
ReDim Preserve Tabl(pos_elt + 2)
Tabl(pos_elt + 2) = Tabl(pos_elt + 1)
Feuille = Left(Tabl(2), InStr(1, Tabl(2), "!") - 1)
Tabl(pos_elt) = Left(Tabl(pos_elt), Len(Tabl(pos_elt)) - 1)
Tabl(pos_elt + 1) = Feuille & "!" & Range(Tabl(pos_elt)).Offset(0, 2).Address & ")"
Var = Join(Tabl, ",")
ActiveChart.SeriesCollection(2).Formula = Var
Var = ActiveChart.SeriesCollection(3).Formula
Tabl = Split(Var, ",")
pos_elt = UBound(Tabl) - 1
ReDim Preserve Tabl(pos_elt + 2)
Tabl(pos_elt + 2) = Tabl(pos_elt + 1)
Feuille = Left(Tabl(2), InStr(1, Tabl(2), "!") - 1)
Tabl(pos_elt) = Left(Tabl(pos_elt), Len(Tabl(pos_elt)) - 1)
Tabl(pos_elt + 1) = Feuille & "!" & Range(Tabl(pos_elt)).Offset(0, 2).Address & ")"
Var = Join(Tabl, ",")
ActiveChart.SeriesCollection(3).Formula = Var
End Sub |
Partager