Sub A_Graphique_Auto()
'MJ le 24 01 2012
deb = ActiveCell.Address
Graphique_Auto
Range(deb).Select
Stop
For i = 1 To 37
ActiveCell.Offset(6, 0).Range("A1:E6").Select
deb = ActiveCell.Address
Graphique_Auto
Range(deb).Select
Next
End Sub
Sub Graphique_Auto()
' MJ Graphique auto_le 23 01 2012
' Stop
Titre = ActiveCell.Offset(1, -8)
Zone = Selection.Address
ActiveSheet.Shapes.AddChart.Select
'ActiveChart.SetSourceData Source:=Range("'RTCD (6)'!$J$3:$N$8")
ActiveChart.SetSourceData Source:=Range(Zone)
ActiveChart.ChartType = xlColumnClustered
ActiveChart.Axes(xlValue).Select
ActiveChart.Axes(xlValue).MinimumScale = 0
ActiveChart.Axes(xlValue).MaximumScale = 80
ActiveChart.Axes(xlValue).MajorUnit = 10
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.Axes(xlValue).Select
ActiveChart.PlotArea.Select
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.ChartArea.Select
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveChart.ChartTitle.Text = "Titre du graphique"
ActiveChart.ChartArea.Select
ActiveChart.ChartTitle.Select
ActiveChart.ChartTitle.Text = Titre '"Titre"
ActiveChart.ChartTitle.Font.Size = 10
ActiveChart.Legend.Select
Selection.Delete
ActiveChart.ChartArea.Select
Selection.Width = 210
Selection.Height = 160
ActiveChart.PlotArea.Select
Selection.Width = 200
Selection.Height = 120
Selection.Left = 10
Selection.Top = 10
MaVAriable = ActiveChart.Name
'MsgBox Split(MaVAriable)(UBound(Split(MaVAriable)))
igraph = Split(MaVAriable)(UBound(Split(MaVAriable)))
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
'Range("O10").Select
ActiveCell.Offset(0, 5).Select
ActiveSheet.Paste
End Sub
Sub Atest1()
'JM extraction derniers chiffres d'un texte
MaVAriable = ActiveChart.Name
MsgBox Split(MaVAriable)(1)
igraph = Split(MaVAriable)(1)
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
Range("O10").Select
ActiveSheet.Paste
End Sub
Sub Atest2()
'JM extraction derniers chiffres d'un texte
MaVAriable = ActiveChart.Name
MsgBox Split(MaVAriable)(UBound(Split(MaVAriable)))
igraph = Split(MaVAriable)(UBound(Split(MaVAriable)))
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
Range("O10").Select
ActiveSheet.Paste
End Sub
Sub Atest3()
'Dranreb extraction derniers chiffres d'un texte
MaVAriable = ActiveChart.Name
MsgBox CLng(Right$(MaVAriable, 2))
igraph = CLng(Right$(MaVAriable, 2))
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
Range("O10").Select
ActiveSheet.Paste
End Sub
Sub Atest4()
'Ges extraction derniers chiffres d'un texte
MaVAriable = ActiveChart.Name
MsgBox Right(MaVAriable, Len(MaVAriable) - InStrRev(MaVAriable, " "))
igraph = Right(MaVAriable, Len(MaVAriable) - InStrRev(MaVAriable, " "))
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
Range("O10").Select
ActiveSheet.Paste
End Sub
Sub Atest5()
'Ges extraction derniers chiffres d'un texte
MaVAriable = ActiveChart.Name
MsgBox Val(Right(MaVAriable, Len(MaVAriable) - InStrRev(MaVAriable, " ")))
igraph = Val(Right(MaVAriable, Len(MaVAriable) - InStrRev(MaVAriable, " ")))
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
Range("O10").Select
ActiveSheet.Paste
End Sub
Sub Atest6()
'MJ extraction derniers chiffres d'un texte
'MsgBox ActiveChart.Name
i = 0
For n = Len(ActiveChart.Name) To 1 Step -1
i = i + 1
'MsgBox Mid(ActiveChart.Name, n, 1)
If IsNumeric(Mid(ActiveChart.Name, n, 1)) Then GoTo suite Else GoTo Suite2
suite:
Next
Suite2:
MsgBox Mid(ActiveChart.Name, Len(ActiveChart.Name) - i + 2, i - 1)
igraph = Mid(ActiveChart.Name, Len(ActiveChart.Name) - i + 2, i - 1)
ActiveSheet.ChartObjects("Graphique " & igraph).Select
Selection.Cut
Range("O10").Select
ActiveSheet.Paste
End Sub