• Cannot Disable ScreenUpdating

    Author
    Topic
    #353705

    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?

    Viewing 3 reply threads
    Author
    Replies
    • #518016

      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.

    • #518076

      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:

      Public Sub Test()
      Dim bScreenUpdatingSave As Boolean
          bScreenUpdatingSave = Application.ScreenUpdating
          Application.ScreenUpdating = False
      
      ' Other code here
      
          Application.ScreenUpdating = bScreenUpdatingSave
      End Sub
      

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

      • #518223

        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

    • #518094

      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?

      • #518112

        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.

        • #518115

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

        • #518122

          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

        • #518127

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

    • #518238

      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

    Viewing 3 reply threads
    Reply To: Cannot Disable ScreenUpdating

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: