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 :

position graphique et format zone de traçage


Sujet :

Macros et VBA Excel

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Janvier 2008
    Messages
    171
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 171
    Par défaut position graphique et format zone de traçage
    bonjour à tous;
    j'ai un probleme que j'arrive pas à resodre depuis ce matin, je bédouille mais pour rien!!!!!!!!!voilà mon probleme je vais créer 6 graphique pour l'instant j'ai crée trois et c dejà le bazard!!je n'arrive pas à les positionner un apres l'autre et en plus la zone de traçage est petite les labele coiside avec les titre!!!!!!!!alors j'ai utiliser l'enregistreur macro pour copier les bonne dimension mais ça ne marche pas? aidez moi svp le bedouilliage ne marche pas sauf s'il ya une autre méthode, voici mon code et merci par avance

    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
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    '------------------------------------------------------------------
    'tracer le graphe: la production en nombre de dossiers selon le grade risque "Conso"
    titre1 = "Production en nombre par grade de risque 'conso'"
    Set graph = Charts.Add
    With graph
    .ChartType = xlPie
    .SetSourceData Source:=[Feuil9].Range("B15:F16"), PlotBy:=xlRows
    .HasTitle = True
    .ChartTitle.Characters.Text = titre1
    .ChartTitle.Left = .ChartArea.Width
    .ChartTitle.Left = .ChartTitle.Left / 2
    decal = .ChartArea.Width / 2 - (.PlotArea.Left + .PlotArea.Width / 2)
    .ChartTitle.Left = .ChartTitle.Left - decal
    .ChartArea.Border.Weight = 2
    .PlotArea.Top = 50
    .PlotArea.Width = 350
    .PlotArea.Height = 174
    .PlotArea.Left = 100
    .PlotArea.Top = 75
    End With
    ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent, LegendKey _
    :=True, HasLeaderLines:=True
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
    ActiveSheet.Shapes(1).IncrementLeft -0.75
    ActiveSheet.Shapes(1).IncrementTop 64.5
    ActiveChart.HasLegend = False
    '------------------------------------------------------------------
    'tracer le graphe :  la production en montant de finacement selon le grade de risque "conso"
    titre2 = "Production en montant par grade de risque 'conso'"
    Set graph = Charts.Add
    With graph
    .ChartType = xlPie
    .SetSourceData Source:=[Feuil9].Range("B15:F15,B17:F17"), PlotBy:=xlRows
    .HasTitle = True
    .ChartTitle.Characters.Text = titre2
    .ChartTitle.Left = .ChartArea.Width
    .ChartTitle.Left = .ChartTitle.Left / 10
    decal = .ChartArea.Width / 2 - (.PlotArea.Left + .PlotArea.Width / 2)
    .ChartTitle.Left = .ChartTitle.Left - decal
    .ChartArea.Border.Weight = 2
    .PlotArea.Top = 70
    .PlotArea.Width = 350
    .PlotArea.Height = 100
    .PlotArea.Left = 250
    .PlotArea.Top = 75
    End With
    ActiveChart.ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent, LegendKey _
    :=True, HasLeaderLines:=True
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
    ActiveSheet.Shapes(2).IncrementLeft 2#
    ActiveSheet.Shapes(2).IncrementTop 12.75
    ActiveChart.HasLegend = False
    '------------------------------------------------------------------
    'graphe: archivage des dossiers par grade de risque
    titre3 = "Archivage des dossiers par grade de risque 'conso'"
    Set graph = Charts.Add
    '[Feuil9].Range("B15:F15,B19:F19,B18:F18").Select
     With graph
        .ChartType = xlColumnStacked
        .SetSourceData Source:=[Feuil9].Range("B15:F15,B18:F19"), PlotBy:=xlRows
        .HasTitle = True
        .ChartTitle.Characters.Text = titre3
        .SeriesCollection(1).Name = "=""dossiers  archivés"""
        .SeriesCollection(2).Name = "=""dossiers non archivés"""
        .HasAxis(xlCategory, xlPrimary) = True
        .HasAxis(xlValue, xlPrimary) = True
        .Axes(xlCategory, xlPrimary).CategoryType = xlAutomatic
    .ChartTitle.Left = .ChartArea.Width
    .ChartTitle.Left = .ChartTitle.Left / 2
    decal = .ChartArea.Width / 2 - (.PlotArea.Left + .PlotArea.Width / 2)
    .ChartTitle.Left = .ChartTitle.Left - decal
    .ChartArea.Border.Weight = 2
    .PlotArea.Top = 50
    .PlotArea.Width = 350
    .PlotArea.Height = 174
    .PlotArea.Left = 100
    .PlotArea.Top = 75
    End With
          With ActiveChart.Axes(xlCategory)
            .HasMajorGridlines = False
            .HasMinorGridlines = False
        End With
        With ActiveChart.Axes(xlValue)
            .HasMajorGridlines = True
            .HasMinorGridlines = False
        End With
    'ActiveChart.ApplyDataLabels Type:= xlDataLabelsShowLabelAndPercent, LegendKey _
    ':=True, HasLeaderLines:=True
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Feuil1"
    ActiveSheet.Shapes(2).IncrementLeft -5.25
    ActiveSheet.Shapes(2).IncrementTop 700.5
    ActiveChart.HasLegend = False
    '------------------------------------------------------------------
    'centrer les titres
    For Each co In ActiveSheet.ChartObjects
    With co.Chart
    .ChartArea.Border.Weight = 2
    .ChartArea.Border.LineStyle = -1
    .ChartArea.Interior.ColorIndex = 36
    .PlotArea.Border.Weight = xlThin
    .PlotArea.Border.LineStyle = xlNone
    .PlotArea.Interior.ColorIndex = 36
    .PlotArea.Interior.PatternColorIndex = 1
    .PlotArea.Interior.Pattern = xlSolid
    End With
    Next
    '------------------------------------------------------------------

  2. #2
    Inactif  
    Avatar de ouskel'n'or
    Profil pro
    Inscrit en
    Février 2005
    Messages
    12 464
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2005
    Messages : 12 464
    Par défaut
    Utilise le left et le top du premier graphe.
    Tu as les largeurs de tes graphes successifs (width)
    Tu positionnes le premier.
    Le left du suivant sera gauche graphe1 (left) + Largeur du graph1 (width) + espace
    Le suivant sera gauche graphe2 + Largeur du graph2 + espace
    Etc.
    L'espace étant celui qui sépare tes graphes si tu veux les espacer en largeur.
    Courage, tu les auras !

  3. #3
    Membre confirmé
    Inscrit en
    Janvier 2008
    Messages
    171
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 171
    Par défaut je n'arrive pas à positionner mes graphes!!
    bonjour tout le monde;
    ouskel'n'or, merci pour ta reponse mais malheuresement ça marche pas!

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    ActiveSheet.Shapes(1).IncrementLeft -3#
    ActiveSheet.Shapes(1).IncrementTop -100#
     
    ActiveSheet.Shapes(2).IncrementLeft -4.5
    ActiveSheet.Shapes(2).IncrementTop 300.75
     
    ActiveSheet.Shapes(2).IncrementLeft -3#
    ActiveSheet.Shapes(2).IncrementTop -105#
    j'ai essayer de positionner le premier graphe, et j'ai remarquer quand j'essaye de positionner les autres le premier deja change de placevraiment je galare avec ça, et en plus j'ai trois autres graphe à ajouter alors si je n'arrive pas à bien positionner ces trois comment je ferai pour la suite!!!!!!! merci par avce

  4. #4
    Membre confirmé
    Inscrit en
    Janvier 2008
    Messages
    171
    Détails du profil
    Informations forums :
    Inscription : Janvier 2008
    Messages : 171
    Par défaut
    j'ai fait du tatonnement et avec ces valeurs pour quatre graphe ça marche, c'est dont j'ai besoin, en fin
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    ActiveSheet.Shapes(1).IncrementLeft -200#
    ActiveSheet.Shapes(1).IncrementTop -200#
     
    ActiveSheet.Shapes(2).IncrementLeft 200#
    ActiveSheet.Shapes(2).IncrementTop 150
     
    ActiveSheet.Shapes(3).IncrementLeft -200
    ActiveSheet.Shapes(3).IncrementTop 150
     
    ActiveSheet.Shapes(4).IncrementLeft 200#
    ActiveSheet.Shapes(4).IncrementTop 150
    merci à tous et bonne journée

  5. #5
    Membre très actif Avatar de Ragmaxone
    Homme Profil pro
    Responsable systèmes de distribution
    Inscrit en
    Août 2007
    Messages
    441
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : Pologne

    Informations professionnelles :
    Activité : Responsable systèmes de distribution

    Informations forums :
    Inscription : Août 2007
    Messages : 441
    Par défaut
    Salut,

    Si tu veux placer ton graphe et non le déplacer tu peux utiliser

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    monGrapheIndiceK.Left = 0 + K* LargeurDeMonGraphe
    monGrapheIndiceK.Top=0
    et si tu veux faire plusieurs ligne faut utiliser des modulo ;o)

    +


    Rag

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

Discussions similaires

  1. Zone de traçage d'un graphique
    Par doctorante 2013 dans le forum Interfaces Graphiques
    Réponses: 1
    Dernier message: 23/06/2015, 08h25
  2. Modifier position graphique d'une zone de texte et traitement des données
    Par Globolite dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 18/06/2014, 18h59
  3. [XL-2007] graphique zone de traçage
    Par splifferwolf dans le forum Excel
    Réponses: 1
    Dernier message: 11/02/2011, 21h47
  4. Réponses: 1
    Dernier message: 23/05/2007, 12h47
  5. Format Zone de Liste Déroulante
    Par Massdiop dans le forum Access
    Réponses: 3
    Dernier message: 09/05/2007, 17h15

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