Macro Chart Ranges

R

Reto Walker

Hi everyone

How can I adjust the following macro to make the MinimumScale value and
MaximumScale value dynamic (by referencing a cell in one of my spreadsheets)
instead of fixed (currently 5400 and 7000)

Sub Macro2()
'
' Macro2 Macro
' Macro recorded 3/15/04 by Reto Walker
'

'
ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScale = 5400
.MaximumScale = 7000
.MinorUnit = 100
.MajorUnit = 500
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
End Sub

Thanks in advance

Regards,

Reto
 
A

Andy Pope

Hi Reto,

The following will use the values in A1 and A2 on Sheet1.

..MinimumScale = Worksheets("Sheet1").Range("A1").value
..MaximumScale = Worksheets("Sheet1").Range("A2").value

Cheers
Andy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top