Private Sub Worksheet_Calculate()
'le tableau T définit les textes et les couleurs des Shapes
Dim s As Shape, p1 As Point, p2 As Point, p3 As Point, p4 As Point, p5 As Point
With ChartObjects(1).Chart
For Each s In .Shapes 'RAZ
s.Delete
Next
Set p1 = .SeriesCollection(1).Points(1)
Set p2 = .SeriesCollection(1).Points(2)
Set p3 = .SeriesCollection(1).Points(3)
Set p4 = .SeriesCollection(1).Points(4)
Set p5 = .SeriesCollection(1).Points(5)
With .Shapes.AddShape(msoShapeRectangle, p1.Left, p4.Top, p2.Left - p1.Left, p1.Top - p4.Top)
.Line.Visible = msoFalse
.TextFrame2.VerticalAnchor = msoAnchorMiddle
.TextFrame2.HorizontalAnchor = msoAnchorCenter
.TextFrame2.TextRange.Characters.Font.Fill.ForeColor.ObjectThemeColor = 1 'police noire
.TextFrame2.TextRange.Characters.Text = [T].Cells(1)
.Fill.ForeColor.RGB = [T].Cells(1, 3).Interior.Color
End With
With .Shapes.AddShape(msoShapeRectangle, p2.Left, p4.Top, p3.Left - p2.Left, p1.Top - p4.Top)
.Line.Visible = msoFalse
.TextFrame2.Orientation = msoTextOrientationUpward
.TextFrame2.VerticalAnchor = msoAnchorMiddle
.TextFrame2.HorizontalAnchor = msoAnchorCenter
.TextFrame2.TextRange.Characters.Font.Fill.ForeColor.ObjectThemeColor = 1
.TextFrame2.TextRange.Characters.Text = [T].Cells(2, 1)
.Fill.ForeColor.RGB = [T].Cells(2, 3).Interior.Color
End With
With .Shapes.AddShape(msoShapeRectangle, p1.Left, p5.Top, p3.Left - p1.Left, p4.Top - p5.Top)
.Line.Visible = msoFalse
.TextFrame2.VerticalAnchor = msoAnchorMiddle
.TextFrame2.HorizontalAnchor = msoAnchorCenter
.TextFrame2.TextRange.Characters.Font.Fill.ForeColor.ObjectThemeColor = 1
.TextFrame2.TextRange.Characters.Text = [T].Cells(3, 1)
.Fill.ForeColor.RGB = [T].Cells(3, 3).Interior.Color
End With
End With
End Sub