+ Reply to Thread
Results 1 to 2 of 2

A vba code command does not execute as it should...

  1. #1
    Registered User
    Join Date
    03-05-2009
    Location
    York, PA
    MS-Off Ver
    Excel 97 & Excel 2007
    Posts
    17

    A vba code command does not execute as it should...

    I have a large vba-based Excel workbook application that I'm developing and I occasionally have a need to update the screens during execution, and other times not update the screens.

    I'm using the:
    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    as needed.

    I have one routine that, when I want no updating of the screens during a particular execution of some code the code command is ignored and the screens update.

    If I step through my code (F8) and execute the
    Please Login or Register  to view this content.
    statement, then hold my mouse over the line of code, the tool tip indicates that screen updating is still set to true.

    If I then type the command in the Immediate window, the tool tip now indicates that the screen updating is set to false. Yet when I press the F5 key to execute the remainder of the code...the screens are updating. There is no instance of the code command that sets the screens to updating = true so I have no idea why the screen updating continues to execute as if set to True.

    Anyone have any ideas?

    I'm using Excel 97 (XP, SP2) and Excel 2007 (Vista).

    Thank you,

    Stu
    Last edited by Stu M; 06-23-2009 at 08:10 PM. Reason: Correct code tags

  2. #2
    Valued Forum Contributor
    Join Date
    06-17-2009
    Location
    Chennai,India
    MS-Off Ver
    Excel 2003,excel 2007
    Posts
    678

    Re: A vba code command does not execute as it should...

    is this macro in a standard module or an event code .

    to understand the statement
    application.screenupdating=false see this quote from

    http://www.ozgrid.com/VBA/excel-macr...en-flicker.htm

    quote
    Those that are familiar with VBA code may also be aware of the term Application.ScreenUpdating. Unfortunately those that really need to know about this term (those that can only record macros) are often not aware of it. By setting ScreenUpdating to False at the Start of the macro, you will not only stop the constant screen flickering associated with recorded macro, but also greatly speed up the execution of the macro. The reason it speeds up code is because Excel no longer needs to repaint the screen whenever it encounters such commands as Select, Activate, LargeScroll, SmallScroll and many others.

    The inclusion of Application.ScreenUpdating=False should be placed at the Start of your macro like shown below
    unquote

    so screen updating does not mean that the macro will not run.

    Is you code an event code which automatically runs the macro whenever an event occurs and not the standard macro.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1