Re: set axis min and max by macro problem

From: Don Guillett (donaldb_at_281.com)
Date: 10/09/04


Date: Sat, 9 Oct 2004 08:35:09 -0500

Here is one that is automatic. The operative lines are
 .MinimumScale = bottom
 .MaximumScale = Top

Private Sub Chart_Activate()
Application.ScreenUpdating = False

With Sheets("Acct Risk")
xas = Application.Min(.[arcols]) - 500
If xas < 0 Then
mc = -500
Else: mc = 500
End If

bottom = Application.Floor(xas, mc)
x = Application.Max(.[arcols])
If x < 0 Then
mct = -500
Else
mct = 500
End If

Top = Application.Ceiling(x, mct)
End With

 ActiveChart.Axes(xlValue).Select
    With ActiveChart.Axes(xlValue)
        .MinimumScale = bottom
        .MaximumScale = Top
        .MinorUnitIsAuto = True
        .MajorUnitIsAuto = True
       ' .MajorUnit = 500
        .Crosses = xlAutomatic
        .ReversePlotOrder = False
        .ScaleType = xlLinear
        .DisplayUnit = xlNone
    End With
 ActiveChart.Deselect
 Application.ScreenUpdating = True
End Sub

-- 
Don Guillett
SalesAid Software
donaldb@281.com
"Gavin" <gavin@menudujour.co.nz> wrote in message
news:ed407d1.0410081942.33cfc34e@posting.google.com...
> I have a macro to automate this process which is not working.
>
> I am sure it is very simple and anyone with some visual basic
> knowledge should see the problem immediately.
>
> Many thanks in advance.
>
> The file is here:
> www.menudujour.co.nz/MenuEngineering.xls
>
> Gavin