Bonjour,
je débute en VBA Excel. Je dois tracer une courbe dans un grahique avec une abscisse et une ordonnée.
J'ai trouvé un exemple dans le support microsoft, que j'ai copié.
Dans le code ci dissous, j'ai un problème a la premiere ligne sur Range("B3:M3").Select
qui indique 'erreur d'execution 1004 - Erreur définie par l'application ou par l'objet'
Je me suis assurée que j'ai bien une feuille active: OK
Quelqu'un peut m'aider?
Merci d'avance
Function traceGraphique(zoneDonnees) As Integer
' Select the range of data of the chart.
Range("B3:M3").Select
' Assign the address of the selected range of cells to a variable.
myrange = Selection.Address
' Assign the name of the active sheet to a variable. This line is
' used in order to allow a chart to be created on a separate chart
' sheet.
mysheetname = ActiveSheet.name
' Add a chart to the active sheet.
ActiveSheet.ChartObjects.Add(125.25, 60, 301.5, 155.25).Select
' To create a chart on a separate chart sheet, remark out the
' previous line, and substitute the next line for the one above.
' Charts.Add
Application.CutCopyMode = False
' This line can best be written by recording a macro, and
' modifying the code generated by the Microsoft Excel Macro
' recorder.
ActiveChart.ChartWizard _
Source:=Sheets(mysheetname).Range(myrange), _
Gallery:=xlLine, Format:=4, PlotBy:=xlRows, _
CategoryLabels:=1, SeriesLabels:=1, HasLegend:=1, _
Title:="", CategoryTitle:="", _
ValueTitle:="", ExtraTitle:=""
End Function
