PDA

View Full Version : screen redraw problem (not ScreenUpdating)



dlh
12-01-2009, 04:20 PM
I have a problem that is similar to ScreenUpdating, but is probably unrelated.

At the end of running my VBA code (with ScreenUpdating = False) the Excel window is cluttered with ghosts of sections of other sheets in my document. Sometimes it's only an control button from another sheet that is redrawn on top of the active sheet. Sometimes it's overlapping sections of every non-hidden sheet in the document, even if my VBA code doesn't have anything to do with the other sheets. When I manually force a screen refresh by clicking the tab of a different sheet and then back, the screen is redrawn correctly.

This problem is occuring only in Excel 2007. The same document's VBA code running under Excel 2003 on a different machine does not have this problem.

I know ScreenUpdating is not the problem, because when I disable the line ScreenUpdating = False, the code does take longer to run, the screen flickers, and the redraw ghosting problem doesn't occur.

Does anyone recognize this behavior? Any advice for diagnosing the cause?

geekgirlau
12-01-2009, 09:45 PM
Haven't experienced it with a macro, although I have seen this behaviour during normal use.

Since Excel doesn't have a "repaint" option, perhaps there is some way to fool it into refreshing the screen. Perhaps one of the following will do the trick (after turning ScreenUpdating back on):

Application.WindowState = xlNormal
Set a worksheet background picture to blank
Set the worksheet to visible = false then visible = true
Set the application to visible = false then visible = true

Paul_Hossler
12-02-2009, 08:33 AM
I've seen that also, but it usually goes away after I re-boot.

My guess is that is has something to do with video memory / resources / etc.

Paul