View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.charting
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default change max scale in chart

Hi,

Now the ActiveSheet is the chart rather than the worksheet. You need to
modify the code so the range reference is to the worksheet containing the
values.
Something like this,

.MaximumScale = Worksheet("Sheet1").Range("o1").Value

Cheers
Andy
--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
"BNT1 via OfficeKB.com" <u19326@uwe wrote in message
news:8a8913faf173d@uwe...
Hi Jon

Thanks for your direction

Followed your link and recorded the macro, then tweeked with the
"Activesheet" etc
All worked ok, however, when moved graph to own sheet, instead of being
inserted in the data sheet, it keeps failing. I have named the chartsheet
"Chart 4".

Can this be amended further to change when the graph is in its own sheet?



Sub testscale()
'
' testscale Macro
' Macro recorded 21/09/2008 by Note
'

'
ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.Axes(xlValue).Select
With ActiveChart.Axes(xlValue)
.MinimumScaleIsAuto = True
.MaximumScale = ActiveSheet.Range("o1").Value
.MinorUnitIsAuto = True
.MajorUnit = ActiveSheet.Range("o2").Value
.Crosses = xlAutomatic
.ReversePlotOrder = False
.ScaleType = xlLinear
.DisplayUnit = xlNone
End With
End Sub

Regards

Brian

Jon Peltier wrote:
This page shows how to do what you're attempting.

http://peltiertech.com/Excel/Charts/...nkToSheet.html

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______

Hi

[quoted text clipped - 27 lines]
Range(mySelection).Select
End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...chart/200809/1