Sub FormattaAsseX() Dim mn As Double, mx As Double mn = Application.WorksheetFunction.Min(Range("E13:E30")) mx = Application.WorksheetFunction.Max(Range("E13:E30")) ActiveSheet.ChartObjects("Grafico 2").Activate With ActiveChart.Axes(xlValue) .MinimumScale = mn .MaximumScale = mx End With End Sub
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("E13:E30")) Is Nothing Then Dim mn As Double, mx As Double mn = Application.WorksheetFunction.Min(Range("E13:E30")) mx = Application.WorksheetFunction.Max(Range("E13:E30")) ActiveSheet.ChartObjects("Grafico 2").Activate With ActiveChart.Axes(xlValue) .MinimumScale = mn .MaximumScale = mx End With End If End Sub
Private Sub CommandButton2_Click() Range("B13:B30,E13:F30").ClearContents End Sub