[VBA-E] Erreur d'éxecution '1004'
Bonjour à tous!
Je souhaite créer une macro qui mette à jour les sources de données d'un graphique.
Ce graphique possède 2 séries.
La macro reçoit 3 arguments :
1°) La ligne max
2°) La colonne 1 (correspondant aux données de la séries 1)
3°) La colonne 2 (correspondant aux données de la séries 2)
Voici mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Sub PourcentCmdParFN(intNbRows, intCol1, intCol2)
'
' PourcentCmdParFN Macro
' Macro enregistrée le 03/01/2007 par administrateur
'
'
ActiveChart.SeriesCollection(2).XValues = "='Commandes FN'!R4C1:R" & (3 + intNbRows) & "C1"
ActiveChart.SeriesCollection(2).Values = "='Commandes FN'!R4C" & intCol2 & ":R" & (3 + intNbRows) & "C" & intCol2
ActiveChart.SeriesCollection(1).XValues = "='Commandes FN'!R4C1:R" & (4 + intNbRows) & "C1"
If intCol2 > 4 Then
ActiveChart.SeriesCollection(1).Values = "='Commandes FN'!R4C" & intCol1 & ":R" & (3 + intNbRows) & "C" & intCol1
Else
ActiveChart.SeriesCollection(1).Values = "={0}"
End If
End Sub |
Je lance cette macro à partir d'un prog VB.Net (framework 1.1), et j'utilise MS Excel 2000 SP-3.
A l'éxecution, l'erreur suivante apparait :
Citation:
Erreur d'éxection '1004'
La méthode 'seriescollection' de l'objet '_chart' a échoué
L'erreur intervient sur la 1ère ligne.
Voici la manière dont j'appelle la macro : PourcentCmdParFN(14, 14, 15)
Merci pour votre aide!
Lionel.