Bonsoir,
si les séries sont vides alors les valeurs à 0 ?
Je ne comprend pas tout mais si vous faisiez une modification de votre code comme ceci :
Sub Etiquettes_Serie()
Application.ScreenUpdating = False
Dim reihe As Integer 'pour serie
Dim indD As Integer ' indice du nom du diagramme
reihe = 2
indD = 1
'
For indD = 1 To ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects("Diagramm " & indD).Activate
'ActiveChart.PlotArea.Select
ActiveChart.ApplyDataLabels
'ActiveChart.SeriesCollection(3).DataLabels.Select
' Selection.ShowSeriesName = True
' Selection.ShowValue = False
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.ShowSeriesName = False
Selection.ShowValue = False
For reihe = 2 To 226
'
ActiveChart.SeriesCollection(reihe).DataLabels.Select
Selection.ShowValue = False
If ActiveChart.SeriesCollection(reihe).Value = 0 Then
Selection.ShowSeriesName = False
Else
Selection.ShowSeriesName = True
' Selection.Separator = " "
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.150000006
.Transparency = 0
.Solid
.Bold = msoTrue ' Selection.Format.TextFrame2.TextRange.Font.Bold
End With
End If
Next reihe
Next indD
End Sub
Je l'avoue, c'est sans conviction vu que je ne comprend pas, mais au vu de ce que je comprend :
If ActiveChart.SeriesCollection(reihe).Value = 0 alors on évite toute la mise en forme "pour rien"
sinon
Else
Selection.ShowSeriesName = True
' Selection.Separator = " "
With Selection.Format.TextFrame2.TextRange.Font.Fill
.Visible = msoTrue
.ForeColor.ObjectThemeColor = msoThemeColorBackground1
.ForeColor.TintAndShade = 0
.ForeColor.Brightness = -0.150000006
.Transparency = 0
.Solid
.Bold = msoTrue ' Selection.Format.TextFrame2.TextRange.Font.Bold
End With
on met en place la mise en forme des données
donc pour toutes données à 0 on évite une grosse partie de la boucle....
Faut voir si je comprend dans le bon sens
@ bientôt
LouReeD