IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Macros et VBA Excel Discussion :

Paramètres de graphiques [XL-2007]


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    68
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 68
    Par défaut Paramètres de graphiques
    à partir d'une macro VBA, je souhaite supprimer le cadre du graphique et colorier le fond de la série nommée "etalon". J'ai essayé avec l'enregistreur de macro mais je ne suis pas parvenu à adapter la syntaxe

    ci-joint mon fichier

    Comment faire? Merci

  2. #2
    Expert éminent Avatar de mercatog
    Homme Profil pro
    Inscrit en
    Juillet 2008
    Messages
    9 435
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations forums :
    Inscription : Juillet 2008
    Messages : 9 435
    Par défaut
    Sur ton fichier
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    Sub FormaterGraph()
    Dim Pt As Point
    Dim i As Integer
    Dim Tb
     
    With Worksheets("test").ChartObjects("Graphique 9").Chart
        .ChartArea.Format.Line.Transparency = 1
        Tb = .SeriesCollection(1).XValues
        For Each Pt In .SeriesCollection(1).Points
            i = i + 1
            If Tb(i) = "etalon" Then
                Pt.Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
                Exit For
            End If
        Next Pt
    End With
    End Sub

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    68
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 68
    Par défaut
    Merci cela fonctionne!

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    68
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 68
    Par défaut
    rebonjour mercatog

    lorsque la série étalon se trouve en première position la macro ne permet pas de colorier le fond de la série.

    j'ai essayé avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
            If Tb(1) = "Budget" Then
                Pt.Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
                Exit For
            End If
    ... mais sans succès. Aurais-tu une solution?

  5. #5
    Expert éminent Avatar de mercatog
    Homme Profil pro
    Inscrit en
    Juillet 2008
    Messages
    9 435
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Autre

    Informations forums :
    Inscription : Juillet 2008
    Messages : 9 435
    Par défaut
    Tb(1)?

    Mets ici ton code en entier

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2010
    Messages
    68
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2010
    Messages : 68
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    Sub histogramme()
     
    Dim dimension1 As Integer
     
    m = 10
    debut1:
    m = m + 1
    If Cells(m, 1) <> "Prix classement" Then
    GoTo debut1
    End If
    debutvertical = m
     
    n = 9
    debut2:
    n = n + 5
    If Cells(debutvertical, n) <> "" Then
    GoTo debut2
    End If
    finhorizontale = n - 5
     
    dimension1 = (finhorizontale - 14) / 5 + 1
     
    ActiveSheet.ChartObjects.Delete
     
    ReDim tabD(dimension1) As String
    ReDim tabCumul(dimension1) As Variant
    Dim i As Integer
     
    x = -1
    For i = 14 To finhorizontale Step (5)
     
        If cestbon = False And Cells(debutvertical - 9, 4).Value < Cells(debutvertical, i).Value Then
        x = x + 1
        tabD(x) = "Budget"
        tabCumul(x) = Cells(debutvertical - 9, 4).Value
        cestbon = True
        jj = (i - 14) / 5 + 1
        End If
     
    x = x + 1
    tabD(x) = Cells(2, i).Value
    tabCumul(x) = Cells(debutvertical, i).Value
    Next i
     
        If cestbon = False Then
        x = x + 1
        tabD(x) = "Budget"
        tabCumul(x) = Cells(debutvertical - 9, 4).Value
        cestbon = True
        jj = (i - 14) / 5 + 1
        End If
     
    Set cht = ActiveSheet.ChartObjects.Add(100, 50, 1000, 400)
    With cht.Chart
        Set ser = .SeriesCollection.NewSeries
        With ser
            .XValues = tabD
            .Values = tabCumul
            .Border.ColorIndex = 5
        End With
     
    ActiveSheet.ChartObjects.Left = Range("A50").Left + 5
    ActiveSheet.ChartObjects.Top = Range("A50").Top + 5
    ActiveSheet.ChartObjects.Width = 550
    ActiveSheet.ChartObjects.Height = 310
     
    .SeriesCollection(1).Format.Fill.ForeColor.ObjectThemeColor = msoThemeColorText1
    .SeriesCollection(1).Format.Fill.ForeColor.Brightness = 0.349999994
    .ChartArea.Format.Line.Visible = False
        Tb = .SeriesCollection(1).XValues
        For Each Pt In .SeriesCollection(1).Points
     
            'If Tb(1) = "Budget" Then
            '    Pt.Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
            '    Exit For
            'End If
     
            g = g + 1
            If Tb(g) = "Budget" Then
                Pt.Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
                Exit For
            End If
        Next Pt
     
        .Legend.Delete
        .SeriesCollection(1).Format.Line.Visible = msoFalse
        .Axes(xlCategory).TickLabels.Orientation = 30
     
    End With
     
    End Sub

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [XL-2003] Paramétrer un graphique
    Par arcane dans le forum Excel
    Réponses: 1
    Dernier message: 14/10/2009, 14h38
  2. [PPT-2007] Paramétrer un graphique sous powerpoint
    Par Invité dans le forum VBA PowerPoint
    Réponses: 5
    Dernier message: 08/10/2009, 10h15
  3. Réponses: 12
    Dernier message: 15/06/2007, 19h16
  4. [NT] Réinitialisation paramètres graphiques
    Par mimic50 dans le forum Windows Serveur
    Réponses: 1
    Dernier message: 13/06/2007, 08h24
  5. paramètres graphiques VBexcel
    Par lipaika dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 21/12/2006, 16h18

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo