Suite à mon ancien topic (ICI), je crée un nouveau topic pour la suite et ainsi traiter mes problèmes pour la création automatique d'un graphique.

J'ai commencé un code pour mettre le graphique. (code automatique de l'enregistrement).

Suite aux remarques j'ai intégré certaine chose.

Néanmoins, ça ne fonctionne pas vraiment et j'aimerai comprendre pourquoi.

Je ne vois pas ce que fait cette ligne, elle change le format, mais comment exactement ?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
Selection.Format.TextFrame2.TextRange.Characters.Text = Range("A2")

De plus mon de s'arrête là :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
With Selection.Format.TextFrame2.TextRange.Characters(1, 13).ParagraphFormat
mais je ne sais pas pourquoi.

De plus mon graphique n'a pas de légende.

Code complet :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
47
48
49
50
51
52
53
    ActiveSheet.Shapes.AddChart2(276, xlAreaStacked).Select
    ActiveChart.SetSourceData Source:=Range("'Chien'!$B$1:$PA$16")
 
    With ActiveSheet.Shapes(1)
        .IncrementLeft -460.5
        .IncrementTop 60
        .ScaleWidth 3.5, msoFalse, msoScaleFromTopLeft
        .ScaleHeight 1.5, msoFalse, msoScaleFromTopLeft
    End With
 
    ActiveChart.ChartTitle.Text = Range("A2")
    Selection.Format.TextFrame2.TextRange.Characters.Text = Range("A2")
 
    With Selection.Format.TextFrame2.TextRange.Characters(1, 13).ParagraphFormat
        .TextDirection = msoTextDirectionLeftToRight
        .Alignment = msoAlignCenter
    End With
 
    With Selection.Format.TextFrame2.TextRange.Characters(1, 5).Font
        .BaselineOffset = 0
        .Bold = msoFalse
        .NameComplexScript = "+mn-cs"
        .NameFarEast = "+mn-ea"
        .Fill.Visible = msoTrue
        .Fill.ForeColor.RGB = RGB(89, 89, 89)
        .Fill.Transparency = 0
        .Fill.Solid
        .Size = 14
        .Italic = msoFalse
        .Kerning = 12
        .Name = "+mn-lt"
        .UnderlineStyle = msoNoUnderline
        .Spacing = 0
        .Strike = msoNoStrike
    End With
 
    With Selection.Format.TextFrame2.TextRange.Characters(6, 8).Font
        .BaselineOffset = 0
        .Bold = msoFalse
        .NameComplexScript = "+mn-cs"
        .NameFarEast = "+mn-ea"
        .Fill.Visible = msoTrue
        .Fill.ForeColor.RGB = RGB(89, 89, 89)
        .Fill.Transparency = 0
        .Fill.Solid
        .Size = 14
        .Italic = msoFalse
        .Kerning = 12
        .Name = "+mn-lt"
        .UnderlineStyle = msoNoUnderline
        .Spacing = 0
        .Strike = msoNoStrike
    End With