Cheres amies , chers amis du forum

je souhaite initialiser mon graph avec des tableau VBA cependant pour une raison que je ne m'explique pas mon code marche 1 fois sur quatre, pourriez vous m'aider.

merci

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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
With ActiveChart
 
        .PlotArea.Interior.ColorIndex = 2
        .PlotArea.Border.LineStyle = xlNone
 
        .HasTitle = True
        .ChartTitle.Characters.Text = "Evolution des cours"
        .ChartTitle.Font.Name = "Arial Narrow"
        .ChartTitle.Font.Size = 15
        .ChartTitle.Font.Bold = True
        .ChartTitle.Font.Italic = True
 
        .Axes(xlCategory).HasTitle = True
        .Axes(xlCategory).AxisTitle.Characters.Text = "Dates"
        .Axes(xlCategory).AxisTitle.Font.Name = "Arial Narrow"
        .Axes(xlCategory).AxisTitle.Font.Size = 10
        .Axes(xlCategory).AxisTitle.Font.Bold = True
        .Axes(xlCategory).AxisTitle.Font.Italic = True
 
        .Axes(xlValue).HasTitle = True
        .Axes(xlValue).AxisTitle.Characters.Text = "Cours"
        .Axes(xlValue).AxisTitle.Font.Name = "Arial Narrow"
        .Axes(xlValue).AxisTitle.Font.Size = 10
        .Axes(xlValue).AxisTitle.Font.Bold = True
        .Axes(xlValue).AxisTitle.Font.Italic = True
 
        .Axes(xlValue).HasMajorGridlines = True
        .Axes(xlCategory).HasMajorGridlines = True
        .Axes(xlValue).MajorGridlines.Border.LineStyle = xlDot
        .Axes(xlCategory).MajorGridlines.Border.LineStyle = xlDot
 
        .Axes(xlValue).TickLabels.Font.Name = "Arial Narrow"
        .Axes(xlValue).TickLabels.Font.Size = 7
 
        .Axes(xlCategory).TickLabels.Font.Name = "Arial Narrow"
        .Axes(xlCategory).TickLabels.Font.Size = 7
        .Axes(xlCategory).TickLabels.NumberFormat = "d/m/yy;@"
 
        .Axes(xlValue).MinimumScaleIsAuto = True
        .Axes(xlValue).MaximumScaleIsAuto = True
 
        .Legend.Font.Name = "Arial Narrow"
        .Legend.Font.Size = 5
        .Legend.Border.LineStyle = xlNone
 
        color = 51
 
    l = 0
        For Each MesSeries In .SeriesCollection
                If Tab_(l) = "CAC 40" Then
                For m = 1 To RangeData.Rows.Count - 1
                    returnarray(m - 1) = ((CalculData(m, l) / CalculData(m - 1, l)) - 1) * 100
                Next m
                    MesSeries.Values = Array(returnarray)
                    MesSeries.AxisGroup = 2
                    MesSeries.Border.ColorIndex = 3
                    MesSeries.Border.Weight = xlThick
                    MesSeries.MarkerStyle = xlMarkerStyleSquare
                    MesSeries.MarkerBackgroundColorIndex = 3
                    MesSeries.MarkerForegroundColorIndex = 3
                    MesSeries.MarkerSize = 2
                    MesSeries.Name = Tab_(l)
                    .Axes(xlValue, xlSecondary).HasTitle = True
                    .Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = "CAC 40"
                    .Axes(xlValue, xlSecondary).AxisTitle.Font.Name = "Arial Narrow"
                    .Axes(xlValue, xlSecondary).TickLabels.Font.Name = "Arial Narrow"
                    .Axes(xlValue, xlSecondary).TickLabels.Font.Size = 7
                    .Axes(xlValue, xlSecondary).AxisTitle.Font.Size = 10
                    .Axes(xlValue, xlSecondary).AxisTitle.Font.Bold = True
                    .Axes(xlValue, xlSecondary).AxisTitle.Font.Italic = True
                Else
                    For m = 1 To RangeData.Rows.Count - 1
                        returnarray(m - 1) = ((CalculData(m, l) / CalculData(m - 1, l)) - 1) * 100
                    Next m
                    MesSeries.Values = Array(returnarray)
                    color = color - 1
                    MesSeries.Border.ColorIndex = color
                    MesSeries.Border.Weight = xlThick
                    MesSeries.MarkerStyle = xlMarkerStyleSquare
                    MesSeries.MarkerBackgroundColorIndex = color
                    MesSeries.MarkerForegroundColorIndex = color
                    MesSeries.MarkerSize = 2
                    MesSeries.Name = Tab_(l)
                End If
            m = m + 1
            l = l + 1
     Next MesSeries
 
    End With