PDA

View Full Version : Excel 2007 - Application.ScreenUpdating won't change?



malik641
06-05-2007, 08:11 PM
In the Immediate window, or in code, I set Application.ScreenUpdating = False without setting it back to True. And after the code is run, I check Application.ScreenUpdating in the Immediate Window and it always says "True" :dunno I've heard of this being reset in earlier versions of Excel (I believe before Excel 2002), has this been changed back? Or am I doing something wrong here?

BTW, I halted the code during the procedure and checked the setting RIGHT after I changed it, and it was as if I never executed the code...:think:

johnske
06-05-2007, 09:22 PM
I've never had any problems leaving out Application.ScreenUpdating = True on 97 or 2000, but I'm told (by Zack) that there is an office version - 2002 or 2003 - that doesn't set it back to true. As I don't have 2002 or 2003 to check this I can only go on what I'm told... :)

But I think the main concern here is one of getting into the habit of 'putting everything back the way it was' cos EnableEvents = False (for one) persists and doesn't automatically get reset to True at the end of a procedure...

unmarkedhelicopter
06-06-2007, 01:54 AM
If you step through code or stop when screenupdating = false then the dubugger assumes you want to see the screen and sets screenupdating to true. Try just running code and have the code set screenudating = false change to another sheet in workbook, wait 2 seconds, then set screenupdating = true and watch what happens.

malik641
06-10-2007, 02:17 PM
Thank you unmarkedhelicopter. That explains things a bit. Now how do I have it so Application.ScreenUpdating will stay FALSE even after the statement/procedure is executed?

Cyberdude
06-10-2007, 03:19 PM
For what it's worth, here's what I get:

Sub X1()
MsgBox Application.ScreenUpdating 'Under Excel 2003 I get "TRUE" here
Application.ScreenUpdating = False
MsgBox Application.ScreenUpdating 'Under Excel 2003 I get "FALSE" here
Call X2
End Sub

Sub X2()
MsgBox Application.ScreenUpdating 'Under Excel 2003 I get "FALSE" here
End Sub

'I execute Sub X3 manually after Sub X2 executes and Sub X1 terminates.
Sub X3()
MsgBox Application.ScreenUpdating 'Under Excel 2003 I get "TRUE" here
End Sub
It appears that FALSE does persist through a CALL to another macro, but after everything finishes, executing another macro will find that FALSE changes to TRUE, which I think is a satisfatory way to have it work.

malik641
06-10-2007, 03:59 PM
Seems to be working the same way for me (Excel 2003)..but before installing Office 2007, I could set it to FALSE in XL2003 and it would stay that way...now it won't. I guess the 2007 version installed something that affected all versions of Office that I have installed (only 2003 and 2007). The same thing happened in the VBE for both versions with the implementation of the ability to use the mouse scroll in the code window. Which I'm VERY happy about, btw :mbounce: