Bonjour,
Merci pour la réponse, ça à l'air de marcher maintenant. Pour être honnête, ce n'est pas moi qui ai créer ce fichier, mais la personne est désormais partie et je n'y connais presque rien en VBA.
Pourquoi la feuille marche sous Excel 2000 et pas 2007?
Maintenant le problème est déplacé à la création d'un graphe:
J'ai de nouveau une erreur 1004 - la methode 'location' de l'objet '_chart' a échoué. Voici la macro en question:
'Chart creation
Charts.Add
ActiveChart.Location where:=xlLocationAsNewSheet, Name:="CHART"
ActiveChart.ChartType = xlXYScatterLines
ActiveChart.SetSourceData Source:=Sheets("PARAM" ).Range("AA" & 1 & ":AD" & n), PlotBy _
:=xlColumns
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(4).Delete
'Humidity curve
ActiveChart.SeriesCollection(1).Name = "Humidity"
'VHP Conc curve
ActiveChart.SeriesCollection(2).Name = "VHP Conc."
'Max allowable VHP curve
ActiveChart.SeriesCollection(3).Name = "Max allowable VHP"
'border
ActiveChart.ChartArea.Border.Color = RGB(255, 255, 255)
'backcolor
ActiveChart.PlotArea.Interior.Color = RGB(255, 255, 255)
'legend
ActiveChart.Legend.Position = xlLegendPositionBottom
ActiveChart.Legend.Border.Color = RGB(255, 255, 255)
ActiveChart.SeriesCollection(1).AxisGroup = xlSecondary
ActiveChart.SeriesCollection(1).MarkerStyle = None
ActiveChart.SeriesCollection(1).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
.Color = RGB(0, 0, 255)
End With
ActiveChart.SeriesCollection(2).MarkerStyle = None
ActiveChart.SeriesCollection(2).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
.Color = RGB(255, 0, 0)
End With
ActiveChart.SeriesCollection(3).MarkerStyle = None
ActiveChart.SeriesCollection(3).Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlAutomatic
.Color = RGB(51, 153, 51)
End With
If Sheets("PARAM" ).CheckBox1.Value = True Then
ActiveChart.SeriesCollection(1).MarkerStyle = xlMarkerStyleCircle
ActiveChart.SeriesCollection(1).MarkerBackgroundColor = RGB(0, 0, 255)
ActiveChart.SeriesCollection(1).MarkerSize = 4
ActiveChart.SeriesCollection(2).MarkerStyle = xlMarkerStyleSquare
ActiveChart.SeriesCollection(2).MarkerBackgroundColor = RGB(255, 0, 0)
ActiveChart.SeriesCollection(2).MarkerSize = 4
ActiveChart.SeriesCollection(3).MarkerStyle = xlMarkerStyleTriangle
ActiveChart.SeriesCollection(3).MarkerBackgroundColor = RGB(51, 153, 51)
ActiveChart.SeriesCollection(3).MarkerSize = 4
Else: GoTo Y
End If
Y: With ActiveChart
.HasTitle = True
.ChartTitle.Font.Bold = True
.ChartTitle.Font.Size = 12
.ChartTitle.Characters.Text = Sheets("PARAM" ).[L1] & Chr(13) & "Min. Chamber Temperature: " & Sheets("PARAM" ).[A22] & "°C"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Time (min)"
.Axes(xlCategory, xlPrimary).AxisTitle.Font.Size = 10
.Axes(xlCategory, xlPrimary).AxisTitle.Font.Bold = True
With .Axes(xlCategory)
.MinimumScale = 0
.MaximumScale = Sheets("PARAM" ).[A4] + Sheets("PARAM" ).[A8] + Sheets("PARAM" ).[A12] + Sheets("PARAM" ).[A16]
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True
.Crosses = xlCustom
.CrossesAt = 0
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "VHP Concentration (mg/L)"
.Axes(xlValue, xlPrimary).AxisTitle.Font.Size = 10
.Axes(xlValue, xlPrimary).AxisTitle.Font.Bold = True
.Axes(xlValue, xlSecondary).HasTitle = True
.Axes(xlValue, xlSecondary).AxisTitle.Characters.Text = "Relative Humidity (%)."
.Axes(xlValue, xlSecondary).AxisTitle.Orientation = 90
.Axes(xlValue, xlSecondary).AxisTitle.Font.Size = 10
.Axes(xlValue, xlSecondary).AxisTitle.Font.Bold = True
End With
If Sheets("PARAM" ).DispT.Value = False Then
ActiveChart.ChartTitle.Characters.Text = Sheets("PARAM" ).[L1]
End If