Application.ScreenUpdating = False not working

Oratia623

New Member
Joined
Jan 21, 2009
Messages
6
Hi,
For some reason Application.ScreenUpdating = False has stopped working for me.

For testing purposes, I have freshly opened Excel (2003 SP3) and into the brand new workbook, added the following macro:
*****************
Sub Test()
Application.ScreenUpdating = False
For i = 1 To 40
ActiveCell = i
ActiveCell.Offset(1, 0).Select
Next i
End Sub
*****************
When I run this macro, I see the individual values being written on the screen.
Stepping through the code and using Watch, I can see that Screenupdating is set to False by the first line, but as soon as the Activecell is changed, Screenupdating is reset to True.

If I turn events off by adding Application.EnableEvents = false to the start of the macro, all works as expected, however I do not want to use this "workaround" as I use event driven macros.

Any ideas what could be the cause?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
In your immediate window type in
Application.ScreenUpdating = True << and press the enter key

then..
Insert a new row in your code that reads
Application.ScreenUpdating = True

Place it one row before the row End Sub
 
Upvote 0
Thanks for the reply.
I tried though and nothing changed.
Even though the help states that you need to reset the Screenupdating to TRUE at the end of the code, it not required.
To confirm, before the macro is run, I enter "debug.Print application.ScreenUpdating" into the debug window and get the answer TRUE.
Were you hoping to reset something?
 
Upvote 0
I'm a bit confused on exactly how Excel **internally** treats or defaults these settings after running such code. Accordingly, I explicitly enter the certain code lines to eliminate any unexpected behavior by Excel.

I sometimes find my event code not working, and must arbitrarily (in the immediate window) enter the Application.EnableEvents = True and WALA!! Everythings OK -- somehow it had gotten "turnned-off"...
 
Upvote 0
Sounds to me like your Event code is resetting the ScreenUpdating (and presumably not via an explicit statement like ScreenUpdating = True). Do you need to have Events enabled whilst you run this code?
 
Upvote 0
It certainly is "doing my head in" as we say down here.
I don't need Events enabled in this particular case, but given the above test (ie new session of Excel & new workbook with simple test macro) this will happen in ALL other mecros, including those times when I will need events enabled...Might have to try re-installing Excel. A bit drastic though, would prefer another option....
 
Upvote 0
does the same thing happen with this version of the code:

Sub Test()
Application.ScreenUpdating = False
For i = 1 To 40
Cells(i, 1) = i
Next i
End Sub
 
Upvote 0
Sorry, excelR8R, public holiday down here.

The same thing happens with your code. As soon as the line Cells(i,1) = i is executed the screenupdating is reset to TRUE.
 
Upvote 0
Greetings Oratia,

Just another way of checking, but in a new workbook, here is yours and excelR&R's.

I ran both, and they both returned FALSE(s) until ScreenUpdating was reset to true.

Code:
Sub Test_ORIG()
Dim i As Integer
 
Application.ScreenUpdating = False
For i = 1 To 40
ActiveCell = i
ActiveCell.Offset(, 1).Value = Application.ScreenUpdating
ActiveCell.Offset(1, 0).Select
Next i
Application.ScreenUpdating = True
 
ActiveCell.Value = Application.ScreenUpdating
 
End Sub
 
 
Sub Test()
Dim i
 
Application.ScreenUpdating = False
For i = 1 To 40
Cells(i, 1) = i
Cells(i, 2) = Application.ScreenUpdating
'Application.Wait Now() + TimeValue("00:00:01")
Next i
Application.ScreenUpdating = True
 
Cells(i + 1, 1).Value = "DONE"
Cells(i + 1, 2).Value = Application.ScreenUpdating
 
End Sub

Mark
 
Upvote 0
Thanks Mark.

Just proves that it is just me! (starting to get paranoid)
I will go through the process of reinstallation today, and hopes that it goes away.

Paul
 
Upvote 0

Forum statistics

Threads
1,215,521
Messages
6,125,306
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top