modifier une macro VBA pour un graphique TCD

guillermo

XLDnaute Nouveau
Bonjour à toutes et à tous,

J'ai fait une macro pour mettre en forme via ctrl+f les valeurs de mon tableau

sauf que quand je selectionne des series supplementaires il me met en forme uniquement les valeurs de serie que j'ai utilise pour ma macro (normal)

je peux modifier le module pour qu'il prenne toutes les series ?

puis aussi creer un bouton de commande type "commandbutton" au lieu de faire crtl+f ?

merci à vous

Sub mise_en_forme()
'
' mise_en_forme Macro
' Macro enregistrée le 30/08/2011 par Grand compte1
'
' Touche de raccourci du clavier: Ctrl+f
'
ActiveChart.SeriesCollection(3).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 12
.Strikethrough = False
.Superscript = True
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(3).Points(8).DataLabel.Select
ActiveChart.SeriesCollection(1).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 12
.Strikethrough = False
.Superscript = True
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(3).DataLabels.Select
ActiveChart.SeriesCollection(3).Points(8).DataLabel.Select
ActiveChart.SeriesCollection(2).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 12
.Strikethrough = False
.Superscript = True
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 2
.Background = xlAutomatic
End With
ActiveChart.SeriesCollection(3).DataLabels.Select
Selection.AutoScaleFont = True
With Selection.Font
.Name = "Arial"
.FontStyle = "Gras"
.Size = 12
.Strikethrough = False
.Superscript = True
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 56
.Background = xlAutomatic
End With
End Sub
 

Etienne2323

XLDnaute Impliqué
Re : modifier une macro VBA pour un graphique TCD

Salut Guillermo,
premièrement, il faudrait que tu apprennes à utiliser les balises de code lorsque tu postes du code VBA. Si tu pouvais éditer ton message avec ces balises, ce serait bien.

Deuxièmement, sans fichier pour tester, difficile de t'aider.

Voici un essai, comme ça :


Code:
For i = 1 To ActiveChart.SeriesCollection.Count
    ActiveChart.SeriesCollection(i).DataLabels.Select
    With Selection.Font
        .Name = "Arial"
        .FontStyle = "Gras"
        .Size = 12
        .Strikethrough = False
        .Superscript = True
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = 56
        .Background = xlAutomatic
    End With
Next i

À te relire pour plus,

Étienne
 

Statistiques des forums

Discussions
312 279
Messages
2 086 728
Membres
103 380
dernier inscrit
prolofief