Erreur d'exécution 438

reda18 -  
f894009 Messages postés 17277 Date d'inscription   Statut Membre Dernière intervention   -
Bonsoir,
j'ai une macro qui est censée me tracer un graphe mais ca me gère une erreur et quand j'appuie sur ok j'ai le graphe tracé quand meme ...
sauf que lorsque je le mets dans une boucle ca sort à cause de l'erreur du coup il faut absolument que je corrige cette erreur ! ma macro est la suivante :

Sub graphique()
Dim charttemp As ChartObject
Dim ch As ChartObject
Dim chartname As Variant
Dim chartindex As Variant
Set charttemp = Worksheets("Feuil1").ChartObjects.Add(Range("B15").Left, Range("B15").Top, 300, 200)
charttemp.Chart.ChartWizard Source:=Worksheets("Feuil1").Range("A1:A10"), _
    gallery:=xlLine, HasLegend:=False, _
    Title:="la on met le titre du graphe", _
    CategoryTitle:="Range of Lengths (mm) by Month", _
    Valuetitle:="Frequency of Lengths"
chartname = charttemp.Name

With charttemp
        ' get object error here (Object doesn't support this property or method)
        .ChartArea.Select
        'title1len = Cells(1, 6).Characters.Count
        With charttemp.ChartTitle
            .Font.Size = 12
            .Characters(1, 30).Font.Size = 18   'title1len
            
        End With
        With .Axes(xlValue)
            .HasMajorGridlines = False
            .HasTitle = True
            With .AxisTitle
                '.Text = Cells(1, 3)
                .Font.Name = "calibri"
                .Font.Size = 12
                .Font.Bold = True
            End With
                
        End With
        With .Axes(xlCategory)
            .HasMajorGridlines = False
            .HasTitle = True
            With .AxisTitle
                '.Text = Cells(1, 2)
                .Font.Name = "calibri"
                .Font.Size = 12
                .Font.Bold = True
            End With

        End With
End With

End Sub




1 réponse

f894009 Messages postés 17277 Date d'inscription   Statut Membre Dernière intervention   1 713
 
Bonjour,

With charttemp.Chart
corrige votre soucis
0