[edit : j'ai utilisé une autre methode en mettant un compteur dans une cellule]
Bonjour,
Je cherche à faire une boucle de condition pour additioner les courbes sur mon graph mais je une erreur s'affiche et je ne comprends pas pourquoi
Sub courbe()
Dim oShape As Excel.Shape
Dim oChart As Excel.Chart
Dim oRange As Excel.Range
Dim oDate As Excel.Range
Dim oSheet As Excel.Worksheet
Set oSheet = ThisWorkbook.Worksheets(1)
Set oShape = oSheet.Shapes("CHART1")
Set oChart = oShape.Chart
Set oRange = oSheet.UsedRange.Columns(4)
Set oDate = oSheet.UsedRange.Columns(1)
If oChart.FullSeriesCollection(1) Is Null Then
x = 1
End If
If oChart.FullSeriesCollection(1) Is Not Null And oChart.FullSeriesCollection(2) Is Null Then
x = 2
End If
If oChart.FullSeriesCollection(1) Is Not Null And oChart.FullSeriesCollection(2) Is Not Null Then
x = 3
End If
oChart.SeriesCollection.NewSeries
oChart.FullSeriesCollection(x).Values = "=" & oSheet.Name & "!" & oRange.Address
oChart.FullSeriesCollection(x).XValues = oDate
End Sub
Cordialement
CJ