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
| Sub Graphique()
Dim v As Integer
Dim Nom
Application.ScreenUpdating = False
v = 2
While Workbooks("Classeur.xls").Worksheets("Données Graph").Cells(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:=myarea, 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
Nom = ActiveSheet.Shapes(3).Name
ActiveSheet.ChartObjects(Nom).Activate
ActiveChart.ChartArea.Select
With Selection.Font
.Size = 6
End With
Application.ScreenUpdating = True
End Sub |
Partager