Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 295
Default When Screenupdating = False is a lie

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 295
Default When Screenupdating = False is a lie

Forgot to mention Excel 2003

"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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default When Screenupdating = False is a lie

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
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default When Screenupdating = False is a lie

Seems like I remember something about screenupdating gets set back to true
after a macro. Might be something about a macro calling a macro. Could try to
add screenupdating=false in the second macro.

Jerry

  #5   Report Post  
Posted to microsoft.public.excel.programming
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



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

Hi Dave, well thanks to that debugging procedure it showed that events, calc
and screen were all being reset on three different occasions, when I fooled
around with the values of cells that also triggered events (don't know how
excel didn't crash). All good now and running much faster because I have
reset calc to false each time.
Thanks very much for your help and tip. Regards, Brett (btw do you have any
clues on the activeX question that I posted?.

"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

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

Hi Jerry, good thought, but not the case. I think that only happens at the
end of all execution. I know that in many instances I only set it once for
executing several macros. Certainly DisplayAlerts is reset at the end of EACH
macro. The real answer can be seen in my last reply to Dave. Thanks for your
reply. Brett

"JerryH" wrote:

Seems like I remember something about screenupdating gets set back to true
after a macro. Might be something about a macro calling a macro. Could try to
add screenupdating=false in the second macro.

Jerry

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default When Screenupdating = False is a lie

If (and it's a big if!) you don't want those events to fire, you can use:

application.screenupdating = false
'a bunch of code here

application.enableevents = false
activesheet.range("a1").value = "hi" 'some event causing code
application.enableevents = true

'a bunch of code
application.screenupdating = true

End sub


I'd recommend that you turn off the events for as little time as you can. And
turn it on right after you're done with that line.

Brettjg wrote:

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


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
screenupdating=false not working [email protected] Excel Programming 1 July 18th 08 09:58 PM
ScreenUpdating = FALSE Cinque Terra Excel Programming 2 April 17th 08 01:43 AM
How to set Application.ScreenUpdating = False for Gen use David_Williams_PG () Excel Discussion (Misc queries) 1 August 15th 06 12:06 PM
What does ScreenUpdating = False do? Judy Ward Excel Worksheet Functions 5 July 9th 05 09:25 AM
Application.ScreenUpdating = False Pieter Kuyck Excel Programming 2 July 15th 03 06:28 PM


All times are GMT +1. The time now is 03:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"