+ Reply to Thread
Results 1 to 5 of 5

Guidance request

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Guidance request

    Hello friends,
    I have a confusion about the following commands.
    When to use those commands?
    What is the use/effect of those commands in the code?
    Which is the proper place to insert this command in the code?

    application.ScreenUpdating = False
    application.EnableEvents = False
    
    ...
    Code
    ...
    
    application.EnableEvents = True
    application.ScreenUpdating = True
    Please guide me to avoide confusion from my mind positively.

    Thanking you in anticipation.

    Mukesh

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,169

    Re: Guidance request

    Hi Mukesh,

    The Application.ScreenUpdating is used to save time. If Excel needs to show you everything it does it takes longer. If you have VBA routines that are taking a long time, you can set the ScreenUpdating to False and Excel can spend time solving the problem and not showing what is happening on the screen. BTW - I had a routine that was going to take about 23 hours and was cut down to only 6 hours with ScreenUpdating = False.

    The Application.EnableEvents is to disable VBA code, that is hidden behind the worksheets from being executed. For example, you might have VBA Event Code that is activated when something on a sheet changes. If the code itself changes something on the sheet, the code will need to run again. In this case you want to turn off the code while you change stuff on the sheet and turn it back on after your code has run.

    I hope that helps a little. Look at all the types of Event Triggers and see if it makes more sense.
    I like this page to explain events http://www.cpearson.com/excel/Events.aspx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Guidance request

    Hello MarvinP,
    Thank you very much for clearing my confusion. Now my concept is clear when to use the application code.

    The link is very good and descriptive to learn vba. I will learn a lot of than my present confusion from it.

    Thank you and have a nice day.

    Mukesh

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Guidance request

    Great answer MarvinP.

    Two additional items:
    1. 'Application.ScreenUpdating = False' sometimes can stop the screen from 'flickering' when several cells are being updated and/or more than one resource (workbook and/or sheet) is being accessed.


    2. 'Application.EnableEvents = False' is also useful when accessing another Excel file that has an AutoRun macro (ThisWorkbook has code in Workbook_Open()). The 'False' value INHIBITS the 'Workbook_Open()' routine from running.

    Lewis

  5. #5
    Forum Contributor
    Join Date
    12-15-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    672

    Re: Guidance request

    Hi LJMetzger,
    Thank you for adding more information to clear the concept.

    Mukesh

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Guidance please.
    By ariffinaldo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-03-2013, 05:20 AM
  2. [SOLVED] VLOOKUP Guidance
    By Karnik in forum Excel General
    Replies: 5
    Last Post: 11-28-2012, 12:52 AM
  3. VBA Form Guidance
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2010, 02:06 PM
  4. MIN() MAX() Guidance HELP!
    By Solida in forum Excel General
    Replies: 1
    Last Post: 03-31-2009, 06:54 PM
  5. Need some guidance
    By nfison in forum Excel General
    Replies: 5
    Last Post: 05-02-2007, 10:31 AM

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