View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
[email protected] Toyin.Butler@googlemail.com is offline
external usenet poster
 
Posts: 14
Default Auto adjust Y-axis for chart with 2

To set the Maximum scale, find the highest value in your series - e.g
dblIntMax in my code below. Then use a function like the one below to
ascertain the scale.

ActiveSheet.ChartObjects("Chart 1").MaximumScale =
IntRoundUp(dblIntMax)

Function IntRoundUp(zRate)
Dim zDecimal As Single, zRound As Single

zDecimal = zRate - Int(zRate)

Select Case zDecimal
Case Is < 0.25
zRound = 0.25
Case Is < 0.5
zRound = 0.5
Case Is < 0.75
zRound = 0.75
Case Is < 1
zRound = 1
End Select

IntRoundUp = Int(zRate) + zRound

End Function

It depends on the increments you are looking for, this example deals
with interest rates and so the rounding is done on 0.25 basis.

hth

Toyin.