chart objects top

N

Neil

Hi,

I have the following code to move a chart to the top of the visible window
which works fine in 2003, however with the same workbook when opened in 2010
i get a runtime error on the line:

ChartObjects(1).Top = Rows(ActiveWindow.ScrollRow).Top

Error is
-2147024809 (80070057)
The specified value is out of range.

Any help in solving this would be greatly appreciated, thanks in advance

Neil

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim ch
'Exit Sub
If Not Intersect(Target, Range("a2:A74")) Is Nothing Then
ChartObjects(1).Top = Rows(ActiveWindow.ScrollRow).Top
For Each ch In ActiveSheet.ChartObjects
If ch.Name = "Chart 15" Then
ch.Visible = True
Updatechart
End If
Next
Else
For Each ch In ActiveSheet.ChartObjects
If ch.Name = "Chart 15" Then ch.Visible = False
Next
End If
End Sub
 
N

Neil

I had the worksheet protected, works as soon as I took off the protection.
Still don't understand why it worked in 2003 with the protection on.

Neil
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top