LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default Moving window to show chart

Hi all,

I want to step through the charts embedded in a worksheet
and selectively delete some of them. My approach,
reflected in the code below, is to change the chartarea
color to something pretty garish so that I can see which
chart is which (there's 106 of them), decide if it should
be deleted, and if not, restore the chartarea color.

Here's the problem: this is a fine idea for charts I can
see (i.e., are in the visible part of the window), but it
clearly is useless if I can't see the chart. So, how do I
move the window so that the chart being operated on is in
the viewing window?


Sub DelCharts()

Dim Last As Long, i As Long
Dim CI, Ans

Last = Worksheets("Test").ChartObjects.Count

For i = Last To 1 Step -1

Application.StatusBar = "Processing Chart " & i
CI = Worksheets("Test").ChartObjects _
(i).Chart.ChartArea.Interior.ColorIndex

Worksheets("Test").ChartObjects _
(i).Chart.ChartArea.Interior.ColorIndex = 4

Ans = MsgBox("Delete?", vbYesNo)
If Ans = vbYes Then
Worksheets("Test").ChartObjects(i).Delete
Else
Worksheets("Test").ChartObjects
(i).Chart.ChartArea.Interior.ColorIndex = CI
End If
Next i

Application.StatusBar = ""

End Sub

Oh, BTW, this works as expected if run from the VBE, but
it doesn't change the chart colors if run from the
worksheet. That's not a big deal for me right now - this
is a once-off effort to solve another problem, but I'm
curious why it works in one case but not the other.
 
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
Moving and resizing the file window Jose Olivencia Excel Discussion (Misc queries) 0 December 4th 09 05:39 PM
Arrow Keys Moving Window Frame instead of Moving Between Cells nemmex Excel Discussion (Misc queries) 2 April 9th 07 09:08 AM
Sub-window not moving or maximizing? MTAR Excel Discussion (Misc queries) 2 February 24th 07 01:41 PM
undo split window moving at the same time mahf08085 Excel Discussion (Misc queries) 3 January 29th 07 04:36 PM
Moving chart window in macro Rustar Excel Programming 3 October 26th 03 01:17 AM


All times are GMT +1. The time now is 03:14 AM.

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

About Us

"It's about Microsoft Excel"