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
   | Sub Graphique()
 
    Dim v As Integer
    Dim Nom
 
    Application.ScreenUpdating = False
 
     v = 2
 
While Workbooks("classeur.xls").Worksheets("Graph").Cel(v,3).Value<> ""
v = v + 1
Wend
 
    dernière_ligne = v - 1
 
    Set myarea = Workbooks("classeur.xls").Worksheets("Données Graph").Range(Cells(1, 3), Cells(dernière_ligne, 6))
 
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("Données Graph").Range("C1:F26"), PlotBy:= _
        xlColumns
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Graph"
    ActiveChart.HasDataTable = True
    ActiveChart.DataTable.ShowLegendKey = True
    ActiveSheet.Shapes(3).ScaleWidth 1.39, msoFalse, _
        msoScaleFromTopLeft
    ActiveSheet.Shapes(3).ScaleWidth 1.31, msoFalse, _
        msoScaleFromBottomRight
    ActiveSheet.Shapes(3).ScaleHeight 1.54, msoFalse, _
        msoScaleFromTopLeft
    ActiveSheet.Shapes(3).ScaleHeight 1.15, msoFalse, _
        msoScaleFromBottomRight
    ActiveChart.Legend.Select
    Selection.Delete
    Selection.AutoScaleFont = True
 
    Nom = ActiveSheet.Shapes(3).Name
    ActiveSheet.ChartObjects(Nom).Activate
    ActiveSheet.ChartObjects(Nom).Select
    Selection.Font.Size = 8
 
    ActiveWindow.Visible = False
 
    Application.ScreenUpdating = True
 
End Sub | 
Partager