bobslay
04-10-2008, 10:13 AM
Hi,
I'm having problem with a very simple piece of code that I've used in a spreadsheet for a couple of years. I had to upgrade to Excel 2007 and now the code crashes each time.
The code is:
Private Sub Worksheet_Change(ByVal Target As Range)
With ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlCategory)
.MaximumScale = ActiveSheet.Range("b42").Value
.MinimumScale = ActiveSheet.Range("a42").Value
End With
End Sub
and each time it runs now it gives the message:
Method 'MaximumScale' of object 'Axis' failed.
I have tried replacing the line with:
.MaximumScale = 100
and the same error occurs.
Can anyone please help?
Thanks
I'm having problem with a very simple piece of code that I've used in a spreadsheet for a couple of years. I had to upgrade to Excel 2007 and now the code crashes each time.
The code is:
Private Sub Worksheet_Change(ByVal Target As Range)
With ActiveSheet.ChartObjects("Chart 1").Chart.Axes(xlCategory)
.MaximumScale = ActiveSheet.Range("b42").Value
.MinimumScale = ActiveSheet.Range("a42").Value
End With
End Sub
and each time it runs now it gives the message:
Method 'MaximumScale' of object 'Axis' failed.
I have tried replacing the line with:
.MaximumScale = 100
and the same error occurs.
Can anyone please help?
Thanks