Rescale the Chat using VBA
Turn on the macro recorder and see what you get for methods and properties.
After editing the code to replace "ActiveChart" with a variable (for easier
debugging later), you should have something like the following. I also added
a quick error handler in case the currently active sheet is a worksheet
instead of a chart.
Sub RescaleChart()
Dim crtMyChart As Chart
On Error GoTo ErrRescaleChart
Set crtMyChart = ActiveWorkbook.Sheets("MyChart")
With crtMyChart.Axes(xlValue)
.MinimumScale = 10
.MaximumScale = 20
End With
With crtMyChart.Axes(xlCategory)
.MinimumScale = 1
.MaximumScale = 5
End With
Exit Sub
ErrRescaleChart:
MsgBox "Sheet is not a chart.", vbCritical + vbOKOnly
End Sub
Replace the constants with appropriate values, or functions that return a
value based on the data. You might also want to pass in an object variable
for the workbook and the chart as arguments, instead of developing them like
I did in the above example.
--
Regards,
Bill
"Peri" wrote in message
...
Can any one help me out in rescaling the Chart using VBA (Visual Basic
Editor) in excel ?
Thanks and Regards,
Peri
|