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
_______
"BNT1 via OfficeKB.com" <u19326@uwe wrote in message
news:8a7d839afd6c5@uwe...
Hi
I am tring to get a macro to change the maximum scale value in a chart,
based
on a cell in the data sheet. In this case G5 in data "sheet1". In cell
G5 ,
I have the max formulaI have named the chart "test". I have pasted the
code
in a module, and if, with help, it works, will paste the second code in
"This
workbook". As you no doubt guessed, I am not too familar with VBA, and
have
managed to get hold of this code, however, it is failing.
Help appriciated
Regards
Sub UpdateScale()
ActiveSheet.ChartObjects("test").Activate
With ActiveChart.Axes(xlValue)
MinimumScale = 0
MaximumScale = Range("G5").Value
End With
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
mySelection = ActiveWindow.RangeSelection.Address
UpdateScale
Range(mySelection).Select
End Sub
--
Message posted via http://www.officekb.com