Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default chart objects top

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default chart objects top

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

"Neil" wrote in message
nd.com...
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Name Chart Objects DCSwearingen Excel Discussion (Misc queries) 2 July 30th 06 10:27 AM
Chart Objects Bill[_30_] Excel Programming 1 June 18th 05 01:34 PM
help with chart objects inquirer Excel Programming 1 October 21st 04 10:31 AM
Chart objects Erich Neuwirth Excel Programming 1 August 13th 04 02:11 AM
Moving Chart Objects Matt Excel Programming 6 May 1st 04 03:34 PM


All times are GMT +1. The time now is 10:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"