View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Brettjg Brettjg is offline
external usenet poster
 
Posts: 295
Default When Screenupdating = False is a lie

That was a great help Dave, TVM. Also a much better way to debug because it
keeps a record of things (never used the immediate window before). Apparently
when I changed the value of one particular cell updating switched back t true
- may have been the result of a change event, except that events are
definitely off otherwise excel crashes. It can remain a mystery, just as long
as it works! Thanks again.

"Dave Peterson" wrote:

I've seen calls to procedures in the analysis tookpak toggle that screenupdating
procedure. But that doesn't seem to fit your situation.

Instead of using msgboxes, you may want to use debug.print. You'll see the
"report" in the immediate window in the VBE.

I'd pepper the code with lines like:

application.screenupdating = false
Debug.print "Before Step 1: " & application.screenupdating
'do a few lines of code
Debug.print "Before step 2: " & application.screenupdating
'a few more lines


Then you can run the procedure and see where true is returned. Then you can be
more thorough. Add a bunch of those debug.print lines between each line of the
portion of code that saw that setting get set to true.

=====
It could be that you're calling another procedure that turns it off, then turns
it back on when it's done????

Brettjg wrote:

Hi there

I'm running a macro that is called from another macro ans updating has been
set to false. However, under some circumstances I can still see the screen
being populated, and of course the macro runs very slowly indeed.

For debugging I included the following lines:

Application.ScreenUpdating = True
If Application.ScreenUpdating = True Then: MsgBox "TRUE"
Application.ScreenUpdating = False
If Application.ScreenUpdating = False Then: MsgBox "FALSE"
code immediately after this populates the page (which is what I can see
happening)

There NO OTHER REFERENCES to updating, except at the end of the caller.

Of course both msgboxes come up (as I would expect, but I can still see the
population happening, so obviously updating is not false at all
or................there's something else going on that I don't understand.
Does anyone have an idea here please? Regards, Brett


--

Dave Peterson