'ajout du nuage de points
Dim i&, plg As Range
Set plg = Sheets("Feuil1").Range("C2:C9")
ActiveSheet.Shapes.AddChart.Select
With ActiveChart
.ChartType = xlXYScatter
.SeriesCollection.NewSeries
With .SeriesCollection(1)
.Name = "=base_pour_graph!$L$1"
.XValues = "=base_pour_graph!$F$2:$F$5000"
.Values = "=base_pour_graph!$L$2:$L$5000"
.MarkerSize = 5
.ApplyDataLabels Type:=xlDataLabelsShowLabel
For i = 1 To plg.Count
With .Points(i)
.MarkerBackgroundColorIndex = 7 - 40 * (plg(i).Value = "M")
.MarkerForegroundColorIndex = 7 - 40 * (plg(i).Value = "M")
.DataLabel.Text = ActiveSheet.Cells(i + 1, 1)
End With
Next i
End With
.Axes(xlCategory).MinimumScale = jeune - 1
.Axes(xlCategory).MaximumScale = vieux + 1
.Axes(xlValue).MinimumScale = echelle_basse
.Axes(xlValue).MaximumScale = hautsalaire + 2000
.Axes(xlCategory).MajorUnit = 1
.Axes(xlValue).TickLabels.NumberFormat = "# ##0"
.SetElement (msoElementPrimaryValueAxisTitleRotated)
.Axes(xlValue, xlPrimary).AxisTitle.Text = "Salaire annuel"
.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
.Axes(xlCategory, xlPrimary).AxisTitle.Text = "Age"
.Location Where:=xlLocationAsNewSheet
.Name = "Graphique"
.Axes(xlValue).MajorUnit = 2000
.SetElement (msoElementChartTitleCenteredOverlay)
.ChartTitle.Text = ""
.Legend.Position = xlBottom
End With
ActiveChart.Deselect