Consulting

Results 1 to 3 of 3

Thread: screen redraw problem (not ScreenUpdating)

  1. #1
    VBAX Regular
    Joined
    Jul 2008
    Posts
    41
    Location

    screen redraw problem (not ScreenUpdating)

    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?
    Last edited by dlh; 12-01-2009 at 04:41 PM.

  2. #2
    VBAX Master geekgirlau's Avatar
    Joined
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    1,464
    Location
    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

  3. #3
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,730
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •