Afficher un message
Vieux 08/02/2006, 22h34   #2 (permalink)
Charly2
XLDnaute Accro
 
Avatar de Charly2
 
Date d'inscription: octobre 2005
Version Excel : Excel 2000 (PC)
Messages: 1 919
Par défaut Re:couleurs d'un graphique

Bonsoir Cruz, bonsoir à toutes et à tous

Je te joins un exemple que tu pourras adapter à tes besoins...

Code:
Option Explicit
Option Base 1

Sub ColorerSecteurs()
'
Dim ValeurSecteur As Variant
Dim Total#, i%
'
  Application.ScreenUpdating = False
  ActiveSheet.ChartObjects(1).Select
  With ActiveChart.SeriesCollection(1)
    ValeurSecteur = .Values
    Total = 0#
    For i = 1 To UBound(ValeurSecteur)
      Total = Total + ValeurSecteur(i)
    Next
    For i = 1 To UBound(ValeurSecteur)
      With .Points(i).Interior
        If (ValeurSecteur(i) / Total) ‹ 0.2 Then
          .ColorIndex = 3
        Else
          .ColorIndex = 6
        End If
      End With
    Next i
  End With
  Range('A1').Select
  Application.ScreenUpdating = False
End Sub
[file name=CruzGraphique.zip size=9814]http://www.excel-downloads.com/components/com_simpleboard/uploaded/files/CruzGraphique.zip[/file]

A+
Fichiers attachés
Type de fichier : zip CruzGraphique.zip (9,6 Ko, 9 affichages)
__________________
Amicalement,
Charly2
Charly2 est déconnecté   Réponse avec citation