My problem is that I'm building a report in Excel for a batch
of product that I have produced that contained many graphics,
depending on product made, the range of the y axis changed,
so to solved my problem I want to know how to put variables
instead of fix numbers for the rande of the y axis.
--
Salutations / Bye / Thanks
Steve Carpentier
E-mail: steve.ca...@concepta.com
E-mail: scarp...@tr.kruger.com
You could keep the "Auto" box checked for each parameter in the Axis
Scale dialog window, and let Excel scale the axes automatically. If you
want to put values into the worksheet that get used for the scaling
parameters, then you could write a macro to scale using these
parameters. The macro would look like this:
Sub ScaleYAxis()
' Select the chart, then run the macro
Dim mySheet As Worksheet
Dim myChart As Chart
Dim myRange As Range
Set mySheet = ActiveSheet
Set myChart = ActiveChart
Set myRange = Application.InputBox _
(prompt:="Please Select a Range" & vbCrLf & vbCrLf & _
"Top to Bottom: Ymin - Ymax - Major - Minor", _
Title:="Enter Range", Type:=8)
With myChart.Axes(xlValue)
.MinimumScale = myRange.Range("A1")
.MaximumScale = myRange.Range("A2")
.MajorUnit = myRange.Range("A3")
.MinorUnit = myRange.Range("A4")
End With
End Sub
Select the chart, then run the macro. You can make a command bar button
and assign it to this macro.
- Jon
_______
Bye Steve !!
Peltier <pel...@home.com> a écrit dans le message :
3A8C8FA6...@home.com...