Colorer les points d'un graph

Bonjour,

je souhaite colorer les points de mon graph selon la couleur de fond des cellules de la colonne J...

J'ai trouvé sur le Site de Eric Renaud le code que voici :
For L = 1 To J
ActiveChart.SeriesCollection(1).Points(L).MarkerBackgroundColorIndex = _
ActiveSheet.Cells("J", l + 1).Interior.ColorIndex
Next L


Mais ça ne marche pas =( ça me dit "Incompatibilité de type"..

Pourriez vous m'aider s'il vous plait ?

Merci d'avance

1 réponse

  1. voici le code complet

    Charts.Add
        ActiveChart.ChartType = xlXYScatter
        ActiveChart.SetSourceData Source:=Sheets("Feuil1").Range("AB2:AB139"), _
            PlotBy:=xlColumns
        'ActiveChart.SeriesCollection.NewSeries
        ActiveChart.SeriesCollection(1).Values = "=Feuil1!R2C28:R139C28"
        ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
    
        With ActiveChart
            .HasAxis(xlCategory, xlPrimary) = False
            .HasAxis(xlValue, xlPrimary) = True
        End With
        ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlAutomatic
        ActiveChart.HasLegend = False
        ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowNone, LegendKey:=False
    For l = 1 To J
                ActiveChart.SeriesCollection(1).Points(l).MarkerBackgroundColorIndex = _
                ActiveSheet.Cells(l + 1, "J").Interior.ColorIndex
    Next l
    
    0