Bonjour,

Je viens de récupérer une fonction vba pour modification.
Mais de base elle bug, donc je ne peux pas la tester dans sa version initiale.

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
 
    Dim minAbs As Double
    Dim maxAbs As Double
    Dim minOrd As Double
    Dim maxOrd As Double
 
    Worksheets(onglet).Select
    minAbs = Worksheets(onglet).Range("Y6").Value
    maxAbs = Worksheets(onglet).Range("Y7").Value
    minOrd = Worksheets(onglet).Range("Z6").Value
    maxOrd = Worksheets(onglet).Range("Z7").Value
 
    MsgBox ("DEBUG - minAbs = " & minAbs & " ; maxAbs = " & maxAbs & " ; minOrd = " & minOrd & "; maxOrd = " & maxOrd)
 
    ActiveSheet.ChartObjects("Chart 1064").Activate
    ActiveChart.ChartArea.Select
    ActiveChart.Axes(xlCategory).Select
 
    With ActiveChart.Axes(xlCategory)
        .MinimumScaleIsAuto = True
        .MaximumScaleIsAuto = True
        .MinimumScale = minAbs
        .MaximumScale = maxAbs
        .MinorUnit = 40
        .MajorUnit = 100
        .Crosses = xlCustom
        .CrossesAt = 38352
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
 
    ActiveChart.Axes(xlValue).Select
 
    With ActiveChart.Axes(xlValue)
        .MinimumScaleIsAuto = True
        .MaximumScaleIsAuto = True
        .MinimumScale = minOrd
        .MaximumScale = maxOrd
        .MinorUnit = 40
        .MajorUnit = 100
        .Crosses = xlCustom
        .CrossesAt = 38352
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
Quand je la lance, le bug intervient à cette ligne
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
With ActiveChart.Axes(xlCategory)
        .MinimumScaleIsAuto = True
Et ça me met .MinimumScaleIsAuto de axis a échoué.
Toutes les variables précedente on pour valeur 1
Sauf xlCategory qui vaut 1.

Est-ce qu'il faut une référence particulière pour utiliser Axis. Sinon pourquoi ça pourrait bugger?

Merci