Bonjour ,
Voila j'ai un message d'erreur sur ce module & j'aimerai le resoudre
Voici mon code :
Sub gr_compte_de_résultats()
Application.ScreenUpdating = False
ThisWorkbook.Sheets("PLAN DE CHARGE").Range("E22").Copy
ThisWorkbook.Sheets("PLAN DE CHARGE").Range("E1616").Copy
'créer un nouveau classeur et y coller les données
Set nouv = Workbooks.Add
Set pg = nouv.Sheets(1)
pg.Paste
pg.Cells(1).PasteSpecial Paste:=xlValues
'figer les données
For num = 1 To 12
.SeriesCollection(num).XValues = ThisWorkbook.Sheets("PLAN DE CHARGE").Range("c22").Value
.SeriesCollection(num).Values = ThisWorkbook.Sheets("PLAN DE CHARGE").Range("c" & num + 2 & "" & num + 2).Value
.SeriesCollection(num).Name = ThisWorkbook.Sheets("PLAN DE CHARGE").Range("b" & num + 2).Value
Next
'tracer le graphique
Set gr = nouv.Charts.Add
With gr
.SetSourceData Source:=Sheets("Feuil1").Range("A1:F5"), PlotBy:=xlRows
.ChartType = xlLine
.Location Where:=xlLocationAsNewSheet
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "années"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "TOTAL_CDC"
.PlotArea.Interior.ColorIndex = 2
.Axes(xlValue).MajorGridlines.Border.LineStyle = xlDot
.ChartArea.Font.Size = 14
.Deselect
End With
Application.ScreenUpdating = True
'faire le ménage
Set pg = Nothing
Set gr = Nothing
Set nouv = Nothing
End Sub
Voila j'ai un message d'erreur sur ce module & j'aimerai le resoudre
Voici mon code :
Sub gr_compte_de_résultats()
Application.ScreenUpdating = False
ThisWorkbook.Sheets("PLAN DE CHARGE").Range("E22").Copy
ThisWorkbook.Sheets("PLAN DE CHARGE").Range("E1616").Copy
'créer un nouveau classeur et y coller les données
Set nouv = Workbooks.Add
Set pg = nouv.Sheets(1)
pg.Paste
pg.Cells(1).PasteSpecial Paste:=xlValues
'figer les données
For num = 1 To 12
.SeriesCollection(num).XValues = ThisWorkbook.Sheets("PLAN DE CHARGE").Range("c22").Value
.SeriesCollection(num).Values = ThisWorkbook.Sheets("PLAN DE CHARGE").Range("c" & num + 2 & "" & num + 2).Value
.SeriesCollection(num).Name = ThisWorkbook.Sheets("PLAN DE CHARGE").Range("b" & num + 2).Value
Next
'tracer le graphique
Set gr = nouv.Charts.Add
With gr
.SetSourceData Source:=Sheets("Feuil1").Range("A1:F5"), PlotBy:=xlRows
.ChartType = xlLine
.Location Where:=xlLocationAsNewSheet
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "années"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "TOTAL_CDC"
.PlotArea.Interior.ColorIndex = 2
.Axes(xlValue).MajorGridlines.Border.LineStyle = xlDot
.ChartArea.Font.Size = 14
.Deselect
End With
Application.ScreenUpdating = True
'faire le ménage
Set pg = Nothing
Set gr = Nothing
Set nouv = Nothing
End Sub