Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

procedure graphe

6 réponses
Avatar
jean-luc Guitard
bonjour,
Dans cette petite macro (pour effectuer plusieurs graphiques) sur excel 2003
il ne trouve pas erreur à ".SeriesCollection.Add plage, xlColumns, True,
True " alors qu'il en trouve une dans excel 2010
Erreur d'execution "5" argument ou appel de procédure incorrect
je ne comprends pas pourquoi, peut-on simplifier cette procédure?
merci à ceux qui savent, bonne journée


Sub Graph_L1()
Application.ScreenUpdating = False
Sheets("Source").Visible = True
If Sheets("L1").ChartObjects.Count <> 0 Then
Sheets("L1").ChartObjects.Delete
Sheets("all active").Select
Range("H1", Range("H65536").End(xlUp)).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:=Range("AR1"), Unique:=True
DerLigne = Range("AR65536").End(xlUp).Row - 1
j = 1
For I = 11 To 11 + DerLigne
Sheets("Source").Select
If Cells(2, I) <> 0 Then
Ma_plage = Union(Range(Cells(1, 10), Cells(4, 10)),
Range(Cells(1, I), Cells(4, I))).Address
Set Risque_Marque = Worksheets(4).ChartObjects.Add(300, 1,
400, 220)
With Risque_Marque.Chart
.SetSourceData Range(Ma_plage), PlotBy:=xlColumns
.ChartType = xl3DPieExploded
.SeriesCollection.Add plage, xlColumns, True, True
.SeriesCollection(1).ApplyDataLabels AutoText:=True,
LegendKey:= _
False, HasLeaderLines:=True,
ShowSeriesName:=False, ShowCategoryName:= _
True, ShowValue:=False,
ShowPercentage:=True, ShowBubbleSize:=False
.ChartTitle.Font.Name = "Clarendon BT"
.ChartTitle.Font.Size = 20
.HasLegend = False
End With

ThisWorkbook.Sheets(4).ChartObjects(j).Activate
ActiveChart.PlotArea.Select
Selection.Width = 300
Selection.Left = 60
Selection.Top = 60
Selection.ClearFormats

ActiveChart.ChartArea.Select
Sheets(4).ChartObjects(j).RoundedCorners = True
Sheets(4).ChartObjects(j).Shadow = True
Selection.Fill.TwoColorGradient
Style:=msoGradientDiagonalUp, Variant:=1
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 44
.Fill.BackColor.SchemeColor = 2
End With

ActiveChart.SeriesCollection(1).Select
Selection.Explosion = 6
For Each p In
ActiveChart.SeriesCollection(1).Points
If Mid(p.DataLabel.Text, 7, 2) = 0 Then
p.HasDataLabel = False
Next p

ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 18
End With
For a = 1 To 3
Niveau = Sheets("Source").Cells(a + 1, 10).Value
If Niveau = "Level1" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 4
If Niveau = "Level2" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 7
If Niveau = "Level3" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 6
Next a
j = j + 1
End If
Next I
Placement
Sheets("L1").Select
Sheets("L1").Cells(1, 1).Select
Sheets("Source").Visible = False
End Sub


Sub Placement()
Sheets(4).Select
NbparLigne = 2
Largeur = 255
Hauteur = 255
Ecart = 10
nbtot = ActiveSheet.ChartObjects.Count
For I = 0 To nbtot - 1
With ActiveSheet.ChartObjects(I + 1)
.Width = Largeur
.Height = Hauteur
.Left = Ecart + (I Mod NbparLigne) * (Ecart + Largeur)
.Top = Ecart + Int(I / NbparLigne) * (Ecart + Hauteur)
End With
Next I
End Sub

6 réponses

Avatar
LSteph
Bonjour,

Sur l'autre c'était plage ou Ma_plage

Un truc qui n'est pas défini.

--
LSteph

On 29 déc, 07:43, "jean-luc Guitard" wrote:
bonjour,
Dans cette petite macro (pour effectuer plusieurs graphiques) sur excel 2 003
il ne trouve pas erreur  ".SeriesCollection.Add plage, xlColumns, True,
True " alors qu'il en trouve une dans excel 2010
Erreur d'execution "5" argument ou appel de proc dure incorrect
je ne comprends pas pourquoi, peut-on simplifier cette proc dure?
merci ceux qui savent, bonne journ e

Sub Graph_L1()
    Application.ScreenUpdating = False
        Sheets("Source").Visible = True
        If Sheets("L1").ChartObjects.Count <> 0 Then
Sheets("L1").ChartObjects.Delete
        Sheets("all active").Select
        Range("H1", Range("H65536").End(xlUp)).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:=Range("AR1"), Unique:=True
        DerLigne = Range("AR65536").End(xlUp).Row - 1
    j = 1
    For I = 11 To 11 + DerLigne
            Sheets("Source").Select
        If Cells(2, I) <> 0 Then
                    Ma_plage = Union(Range(Cells(1, 10), Cells(4, 10)),
Range(Cells(1, I), Cells(4, I))).Address
                Set Risque_Marque = Worksheets(4).Chart Objects.Add(300, 1,
400, 220)
                    With Risque_Marque.Chart
                        .SetSourceData Range(Ma_p lage), PlotBy:=xlColumns
                        .ChartType = xl3DPieExp loded
                        .SeriesCollection.Add pla ge, xlColumns, True, True
                        .SeriesCollection(1).Appl yDataLabels AutoText:=True,
LegendKey:= _
                            False, HasLeaderL ines:=True,
ShowSeriesName:lse, ShowCategoryName:= _
                                True, Sho wValue:lse,
ShowPercentage:=True, ShowBubbleSize:lse
                        .ChartTitle.Font.Name = "Clarendon BT"
                        .ChartTitle.Font.Size = 20
                        .HasLegend = False
                    End With

                        ThisWorkbook.Sheets(4).Ch artObjects(j).Activate
                        ActiveChart.PlotArea.Sele ct
                            Selection.Width = 300
                            Selection.Left = 60
                            Selection.Top = 60
                            Selection.ClearFo rmats

                        ActiveChart.ChartArea.Sel ect
                            Sheets(4).ChartOb jects(j).RoundedCorners = True
                            Sheets(4).ChartOb jects(j).Shadow = True
                            Selection.Fill.Tw oColorGradient
Style:=msoGradientDiagonalUp, Variant:=1
                                With Sele ction
                                    . Fill.Visible = True
                                    . Fill.ForeColor.SchemeColor = 44
                                    . Fill.BackColor.SchemeColor = 2
                                End With

                        ActiveChart.SeriesCollect ion(1).Select
                            Selection.Explosi on = 6
                            For Each p In
ActiveChart.SeriesCollection(1).Points
                                If Mid(p. DataLabel.Text, 7, 2) = 0 Then
p.HasDataLabel = False
                            Next p

                        ActiveChart.SeriesCollect ion(1).DataLabels.Select
                        Selection.AutoScaleFont = True
                            With Selection.Fo nt
                                .Name = "Arial"
                                .Size = 18
                            End With
                For a = 1 To 3
                    Niveau = Sheets("Source").Cells (a + 1, 10).Value
                    If Niveau = "Level1" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 4
                    If Niveau = "Level2" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 7
                    If Niveau = "Level3" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 6
                Next a
            j = j + 1
        End If
    Next I
Placement
        Sheets("L1").Select
        Sheets("L1").Cells(1, 1).Select
        Sheets("Source").Visible = False
   End Sub

Sub Placement()
    Sheets(4).Select
    NbparLigne = 2
    Largeur = 255
    Hauteur = 255
    Ecart = 10
    nbtot = ActiveSheet.ChartObjects.Count
    For I = 0 To nbtot - 1
        With ActiveSheet.ChartObjects(I + 1)
            .Width = Largeur
            .Height = Hauteur
            .Left = Ecart + (I Mod NbparLigne) * (Ecart + L argeur)
            .Top = Ecart + Int(I / NbparLigne) * (Ecart + H auteur)
        End With
    Next I
End Sub
Avatar
jean-luc Guitard
Sur l'autre c'était identique j'ai fait un copié collé
donc c'était plage, avec Ma_plage sur le 2010 ça marche mais je ne comprends
pas pourquoi
ça marche sur excel 2003 avec plage et pas sur le 2010?

"LSteph" a écrit dans le message de groupe de
discussion :

Bonjour,

Sur l'autre c'était plage ou Ma_plage

Un truc qui n'est pas défini.

--
LSteph

On 29 déc, 07:43, "jean-luc Guitard" wrote:
bonjour,
Dans cette petite macro (pour effectuer plusieurs graphiques) sur excel
2003
il ne trouve pas erreur ".SeriesCollection.Add plage, xlColumns, True,
True " alors qu'il en trouve une dans excel 2010
Erreur d'execution "5" argument ou appel de proc dure incorrect
je ne comprends pas pourquoi, peut-on simplifier cette proc dure?
merci ceux qui savent, bonne journ e

Sub Graph_L1()
Application.ScreenUpdating = False
Sheets("Source").Visible = True
If Sheets("L1").ChartObjects.Count <> 0 Then
Sheets("L1").ChartObjects.Delete
Sheets("all active").Select
Range("H1", Range("H65536").End(xlUp)).AdvancedFilter
Action:=xlFilterCopy, CopyToRange:=Range("AR1"), Unique:=True
DerLigne = Range("AR65536").End(xlUp).Row - 1
j = 1
For I = 11 To 11 + DerLigne
Sheets("Source").Select
If Cells(2, I) <> 0 Then
Ma_plage = Union(Range(Cells(1, 10), Cells(4, 10)),
Range(Cells(1, I), Cells(4, I))).Address
Set Risque_Marque = Worksheets(4).ChartObjects.Add(300,
1,
400, 220)
With Risque_Marque.Chart
.SetSourceData Range(Ma_plage), PlotBy:=xlColumns
.ChartType = xl3DPieExploded
.SeriesCollection.Add plage, xlColumns, True,
True
.SeriesCollection(1).ApplyDataLabels
AutoText:=True,
LegendKey:= _
False, HasLeaderLines:=True,
ShowSeriesName:úlse, ShowCategoryName:= _
True, ShowValue:úlse,
ShowPercentage:=True, ShowBubbleSize:úlse
.ChartTitle.Font.Name = "Clarendon BT"
.ChartTitle.Font.Size = 20
.HasLegend = False
End With

ThisWorkbook.Sheets(4).ChartObjects(j).Activate
ActiveChart.PlotArea.Select
Selection.Width = 300
Selection.Left = 60
Selection.Top = 60
Selection.ClearFormats

ActiveChart.ChartArea.Select
Sheets(4).ChartObjects(j).RoundedCorners =
True
Sheets(4).ChartObjects(j).Shadow = True
Selection.Fill.TwoColorGradient
Style:=msoGradientDiagonalUp, Variant:=1
With Selection
.Fill.Visible = True
.Fill.ForeColor.SchemeColor = 44
.Fill.BackColor.SchemeColor = 2
End With

ActiveChart.SeriesCollection(1).Select
Selection.Explosion = 6
For Each p In
ActiveChart.SeriesCollection(1).Points
If Mid(p.DataLabel.Text, 7, 2) = 0 Then
p.HasDataLabel = False
Next p

ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.Size = 18
End With
For a = 1 To 3
Niveau = Sheets("Source").Cells(a + 1, 10).Value
If Niveau = "Level1" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 4
If Niveau = "Level2" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 7
If Niveau = "Level3" Then
Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 6
Next a
j = j + 1
End If
Next I
Placement
Sheets("L1").Select
Sheets("L1").Cells(1, 1).Select
Sheets("Source").Visible = False
End Sub

Sub Placement()
Sheets(4).Select
NbparLigne = 2
Largeur = 255
Hauteur = 255
Ecart = 10
nbtot = ActiveSheet.ChartObjects.Count
For I = 0 To nbtot - 1
With ActiveSheet.ChartObjects(I + 1)
.Width = Largeur
.Height = Hauteur
.Left = Ecart + (I Mod NbparLigne) * (Ecart + Largeur)
.Top = Ecart + Int(I / NbparLigne) * (Ecart + Hauteur)
End With
Next I
End Sub



Avatar
DanielCo
Bonjour.
"plage" doit être une variable range; tel quel, utilise "Range(plage)"
(ou range(Ma_Plage) ).
Cordialement.
Daniel
Avatar
LSteph
Un copié collé du Classeur ou juste de ce bout de code?

Pour "plage" il n'y a rien dans ce qu'on lit dans le code de défini
alors que pour "Ma_plage" on a au moins une adresse

Ma_plage = Union(Range(Cells(1, 10), Cells(4, 10)),Range(Cells(1, I),
Cells(4, I))).Address

donc je suppose que dans ton autre classeur il y a quelquechose que
désigne "plage"

sans doute un objet ou variable définie dans un autre module
globalement.





On 29 déc, 11:41, "jean-luc Guitard" wrote:
Sur l'autre c' tait identique j'ai fait un copi coll
donc c' tait plage, avec Ma_plage sur le 2010 a marche mais je ne compren ds
pas pourquoi
a marche sur excel 2003 avec plage et pas sur le 2010?

"LSteph" a crit dans le message de groupe de
discussion :




> Bonjour,

> Sur l'autre  c' tait plage ou Ma_plage

> Un truc qui  n'est pas d fini.

> --
> LSteph

> On 29 d c, 07:43, "jean-luc Guitard" wrote:
>> bonjour,
>> Dans cette petite macro (pour effectuer plusieurs graphiques) sur exce l
>> 2003
>> il ne trouve pas erreur  ".SeriesCollection.Add plage, xlColumns, Tr ue,
>> True " alors qu'il en trouve une dans excel 2010
>> Erreur d'execution "5" argument ou appel de proc dure incorrect
>> je ne comprends pas pourquoi, peut-on simplifier cette proc dure?
>> merci ceux qui savent, bonne journ e

>> Sub Graph_L1()
>>     Application.ScreenUpdating = False
>>         Sheets("Source").Visible = True
>>         If Sheets("L1").ChartObjects.Count <> 0 Then
>> Sheets("L1").ChartObjects.Delete
>>         Sheets("all active").Select
>>         Range("H1", Range("H65536").End(xlUp)).AdvancedFilter
>> Action:=xlFilterCopy, CopyToRange:=Range("AR1"), Unique:=True
>>         DerLigne = Range("AR65536").End(xlUp).Row - 1
>>     j = 1
>>     For I = 11 To 11 + DerLigne
>>             Sheets("Source").Select
>>         If Cells(2, I) <> 0 Then
>>                     Ma_plage = Union(Range(Cells (1, 10), Cells(4, 10)),
>> Range(Cells(1, I), Cells(4, I))).Address
>>                 Set Risque_Marque = Worksheets(4).Ch artObjects.Add(300,
>> 1,
>> 400, 220)
>>                     With Risque_Marque.Chart
>>                         .SetSourceData Range(M a_plage), PlotBy:=xlColumns
>>                         .ChartType = xl3DPie Exploded
>>                         .SeriesCollection.Add plage, xlColumns, True,
>> True
>>                         .SeriesCollection(1).A pplyDataLabels
>> AutoText:=True,
>> LegendKey:= _
>>                             False, HasLead erLines:=True,
>> ShowSeriesName:lse, ShowCategoryName:= _
>>                                 True, ShowValue:lse,
>> ShowPercentage:=True, ShowBubbleSize:lse
>>                         .ChartTitle.Font.Name = "Clarendon BT"
>>                         .ChartTitle.Font.Size = 20
>>                         .HasLegend = False
>>                     End With

>>                         ThisWorkbook.Sheets(4) .ChartObjects(j).Activate
>>                         ActiveChart.PlotArea.S elect
>>                             Selection.Widt h = 300
>>                             Selection.Left = 60
>>                             Selection.Top = 60
>>                             Selection.Clea rFormats

>>                         ActiveChart.ChartArea. Select
>>                             Sheets(4).Char tObjects(j).RoundedCorners =
>> True
>>                             Sheets(4).Char tObjects(j).Shadow = True
>>                             Selection.Fill .TwoColorGradient
>> Style:=msoGradientDiagonalUp, Variant:=1
>>                                 With S election
>>                                     .Fill.Visible = True
>>                                     .Fill.ForeColor.SchemeColor = 44
>>                                     .Fill.BackColor.SchemeColor = 2
>>                                 End Wi th

>>                         ActiveChart.SeriesColl ection(1).Select
>>                             Selection.Expl osion = 6
>>                             For Each p In
>> ActiveChart.SeriesCollection(1).Points
>>                                 If Mid (p.DataLabel.Text, 7, 2) = 0 Then
>> p.HasDataLabel = False
>>                             Next p

>>                         ActiveChart.SeriesColl ection(1).DataLabels.Select
>>                         Selection.AutoScaleFon t = True
>>                             With Selection .Font
>>                                 .Name = "Arial"
>>                                 .Size = 18
>>                             End With
>>                 For a = 1 To 3
>>                     Niveau = Sheets("Source").Ce lls(a + 1, 10).Value
>>                     If Niveau = "Level1" Then
>> Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 4
>>                     If Niveau = "Level2" Then
>> Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 7
>>                     If Niveau = "Level3" Then
>> Risque_Marque.Chart.SeriesCollection(1).Points(a).Interior.ColorIndex = 6
>>                 Next a
>>             j = j + 1
>>         End If
>>     Next I
>> Placement
>>         Sheets("L1").Select
>>         Sheets("L1").Cells(1, 1).Select
>>         Sheets("Source").Visible = False
>>    End Sub

>> Sub Placement()
>>     Sheets(4).Select
>>     NbparLigne = 2
>>     Largeur = 255
>>     Hauteur = 255
>>     Ecart = 10
>>     nbtot = ActiveSheet.ChartObjects.Count
>>     For I = 0 To nbtot - 1
>>         With ActiveSheet.ChartObjects(I + 1)
>>             .Width = Largeur
>>             .Height = Hauteur
>>             .Left = Ecart + (I Mod NbparLigne) * (Ecart + Largeur)
>>             .Top = Ecart + Int(I / NbparLigne) * (Ecart + Hauteur)
>>         End With
>>     Next I
>> End Sub- Masquer le texte des messages précédents -

- Afficher le texte des messages précédents -
Avatar
jean-luc Guitard
merci de vos réponses
les programmes sont identiques et il n' y a rien qui désigne "plage"dans
excel 2003
mais ça fonctionne si je mets Ma_plage dans excel 2010 à la place de plage
Avatar
LSteph
Que tu aies le même programme si tu n'a copié que lui c'est forcé. Ce
n'est pas pareil que tout le classeur.
As-tu regardé les autres modules du Classeur d'origine, il y a de
toute évidence besoin d'une adresse du range ou d'un range, sinon cele
ne fonctionnerait pas non plus.



On 29 déc, 13:05, "jean-luc Guitard" wrote:
merci de vos réponses
les programmes sont identiques  et il n' y a rien qui désigne "plage" dans
excel 2003
mais ça fonctionne si je mets Ma_plage dans excel 2010 à la place de plage