View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_5_] Bob Phillips[_5_] is offline
external usenet poster
 
Posts: 620
Default ScreenUpdating automatically resets to True

It's nothing to do with activating a worksheet, it is simply local to the
procedure it is set in. When that procedure ends, it reverts back to True,
as stated in the online help.

--

HTH

Bob Phillips

"onedaywhen" wrote in message
m...
The ScreenUpdating property seems to implicitly/automatically be set
to true when a worksheet is activated. Is this expected behaviour? I
would expect the value of ScreenUpdating to persist until *I* change
it.

Here's some code that demonstrates what I mean (paste it into all
worksheet code modules):

Private Sub Worksheet_Deactivate()
With Application
.ScreenUpdating = False
.Cursor = xlWait
End With
End Sub

Private Sub Worksheet_Activate()
With Application
Stop ' ScreenUpdating should be False
.ScreenUpdating = True
.Cursor = xlDefault
End With
End Sub

When the Stop is encountered ScreenUpdating should be false; it was
set to false when the cursor was changed to the hourglass. However, at
the Stop I have the hourglass cursor but ScreenUpdating is now true.

Sure, I can turn it off again but I get a flicker each time I toggle
this property. And because in reality I'm using the
_Activate/_Deactivate events to run initialize/cleanup code, possibly
reactivating the worksheets in the process, this is adding up to a lot
of flickering ... which is of course what I was trying to eliminate by
turning ScreenUpdating off!

Is this something I've got to learn to live with or is it likely I'm
doing something wrong?