modifier taille police legende graphique

nicroq

XLDnaute Occasionnel
Bonjour,

Je souhaiterai par VBA modifier la taille de police de la légende de tous les graphique présents sur la feuil1 :
voici mon code que je n'arriv epas à faire marcher :

Sub taille_polie_graph()

Set f1 = Worksheets(Feuil1.Name)
Application.ScreenUpdating = False
On Error Resume Next


Dim forme As Shape
For Each forme In f1.Shapes
With forme
.Legend.Select
.Format.TextFrame2.TextRange.Font.Size = 50
End With

Next forme

End Sub

merci pour votre aide
 

job75

XLDnaute Barbatruc
Bonsoir Nicroq,

A partir d'Excel 2007 (ou 2010 je ne me souviens pas) :
Code:
Sub taille_police_graph1()
Dim ch As ChartObject
For Each ch In ActiveSheet.ChartObjects
  If ch.Chart.HasLegend Then ch.Chart.Legend.Format.TextFrame2.TextRange.Font.Size = 50
Next
End Sub
Sur toutes versions Excel :
Code:
Sub taille_police_graph2()
Dim ch As ChartObject
For Each ch In ActiveSheet.ChartObjects
  If ch.Chart.HasLegend Then ch.Chart.Legend.Font.Size = 50
Next
End Sub
C'est quand même plus simple !

A+
 

Discussions similaires

Statistiques des forums

Discussions
311 708
Messages
2 081 750
Membres
101 812
dernier inscrit
trufu