Function GraphPresent() As Boolean
[COLOR="SeaGreen"]'On test la présence d'un graphe dans ActiveChart[/COLOR]
If ActiveChart Is Nothing Then
GraphPresent = False
MsgBox "Veuillez séléctionner un graphique."
Else
GraphPresent = True
End If
End Function
Sub ZoomPlus()
If Not GraphPresent Then Exit Sub [COLOR="SeaGreen"]'On lance la macro seulement si un graphe est séléctionné[/COLOR]
Dim Min As Long
Dim Max As Long
Dim Range As Long [COLOR="SeaGreen"]'Range sera égal à Max-Min[/COLOR]
[COLOR="SeaGreen"]'Zoom sur les abscisses[/COLOR]
[COLOR="Red"]ActiveChart.Axes(xlCategory).Select[/COLOR]
With ActiveChart.Axes(xlCategory)
Min = .MinimumScale
Max = .MaximumScale
Range = Max - Min
[COLOR="SeaGreen"]'on change l'échelle pour qu'elle corresponde à un zoom x2 des aires[/COLOR]
.MinimumScale = Min + Range * 0.15
.MaximumScale = Max - Range * 0.15
End With
[COLOR="SeaGreen"]'Zoom sur les ordonnées (idem que pour les abscisses)[/COLOR]
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
Min = .MinimumScale
Max = .MaximumScale
Range = Max - Min
[COLOR="SeaGreen"]'on change l'échelle[/COLOR]
.MinimumScale = Min + Range * 0.15
.MaximumScale = Max - Range * 0.15
End With
End Sub