Results 1 to 10 of 10
  1. #1
    New Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cannot Disable ScreenUpdating

    I am writing some vba code, using Excel 97 SR-2 on an NT-4.0 platform. The problem that I'm running into is that I cannot disable ScreenUpdating. The line of code:
    Application.ScreenUpdating = False
    executes, but it does not change the ScreenUpdating property. This is resulting in some extremely slow processing times. Any ideas as to what might be causing this?

  2. #2
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Silicon Valley, California, USA
    Posts
    273
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    Humm,

    I don't have an answer, but the fact that you are running it on NT caught my eye. I noticed at least one thing about Excel 97 on NT4 which is different from on Windows 95/98; when you show a chart sheet, the zoom level seems to be disabled. I discovered this when I ran some code that automatically sets the zoom level to "Fit" (on a Windows 98 platform); when you run it on NT, you get a runtime error (I forget exactly which).

    I hope this is a useful clue. However, that same situation involved using the ScreendUpdating = False, and it worked fine.

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    The statement you showed should definitely turn screenupdating off. Have you checked to see if the screenupdating property is definitely False immediately after that statement executes? If it is, then my best guess is that you are calling another sub or function that is turning it back on. This can happen because the sub or function just turns it off at the beginning and on at the end without any regard for how it was set when the routine was entered. If you determine that it is definitely being turned off, then you might stick some If statments in your code to display a MsgBox when it finds that it has been turned back on.

    What I usually do, instead of just turning screenupdating on and off is the following:

    <pre>Public Sub Test()
    Dim bScreenUpdatingSave As Boolean
    bScreenUpdatingSave = Application.ScreenUpdating
    Application.ScreenUpdating = False

    ' Other code here

    Application.ScreenUpdating = bScreenUpdatingSave
    End Sub
    </pre>


    That will leave ScreenUpdating set like it was when the procedure was entered.
    Legare Coleman

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    Patrick,

    What are you trying to do?

    There are some processes which do some screen processing, which Application.Screenupdating does not turn off.

    Can you attach a (cut down and make everything private) spreadsheet?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    New Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    I've attached a workbook that demonstrates the problem I've had. The routine in this file simply sets the ScreenUpdating property, then runs through a For...Next loop to count from 1 to a specified value. The time required to execute the loop is displayed on the sheet.

    I still haven't figured out what the problem is, but it seems to be machine specific. When I run this procedure on the machine that I first encountered the problem, the problem still persists. On another machine, however, ScreenUpdating can be disabled. Very Strange.

    Thanks for the help.
    Attached Files Attached Files

  6. #6
    New Lounger
    Join Date
    Jan 2001
    Location
    Illinois
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    I forgot to mention that both machines I have tried this on use Excel 97 SR-2 on an NT-4.0 platform.

  7. #7
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    Excel 97 on NT4

    When value in A1 = 0 no screen updating, which is what I would expect, so it seems to be fine.

    Andrew C

  8. #8
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    Your spreadsheet seems to work just as I would expect it to on my Excel 2000 on Windows 2000.
    Legare Coleman

  9. #9
    Silver Lounger
    Join Date
    Jan 2001
    Location
    West Long Branch, New Jersey, USA
    Posts
    1,921
    Thanks
    6
    Thanked 9 Times in 7 Posts

    Re: Cannot Disable ScreenUpdating

    Legare,

    I too had a problem like this with Excel 97 on Win 98. In a project I was doing, I wrote a subroutine and included the Application.Screenupdating statements. That worked fine. I then wrote another routine and it didn't work at all (lots of blinking as it went thru 7 items and blinked each time). When I brought this over to my client (Excel 2000 on Win 98), same results.

    I may have to go back and look to see if anything on this thread solves the "blinking" problem.

    Fred

  10. #10
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Dallas plus 20 miles or so, Texas, USA
    Posts
    876
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cannot Disable ScreenUpdating

    Hi Patrick,

    From what I can tell, using the "TRUE" in cell A1 does not disable screenupdating. I commented your code and typed in Application.ScreenUpdating=false before and after the loop and screenupdating was disabled.

    However, when I changed cell A1 to 0, screen updating was disabled. When I changed cell A1 to 1, screen updating was enabled.

    HTH,
    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •