+ Reply to Thread
Results 1 to 7 of 7

[SOLVED] VBA Application.EnableEvents and Application.ScreenUpdating

  1. #1
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

    [SOLVED] VBA Application.EnableEvents and Application.ScreenUpdating

    Situation: I have many sheets in my workbook and I need to change all of the reference cell value when I change the main cell value.

    Problem: I have a minor problem in my EXCEL, when I run this code my excel stop 3~5 secs. Can someone define the problem? Why it stop 5secs?

    Do this problem can deal with the Application.EnableEvent / Application.ScreenUpdating?
    *I don't know where I will put it.

    This is my code:
    Please Login or Register  to view this content.
    Last edited by mcmunoz; 09-01-2013 at 10:27 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    Hi,

    Try putting
    Please Login or Register  to view this content.
    after you have completed declaring your variables ("Dim" statements), and then
    Please Login or Register  to view this content.
    just before the end of the subroutine.

    Hope this helps

  3. #3
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    Thank you for your help where I will put the application.ScreenUpdating. But still it stop 3~5 secs Does my code have an error or do my code is too hard and long to perform?

    Why I want to resolve about this issue (hangs 3~5 secs), because someone will use this code and they will taught why it hangs like that...... bla bla.
    Last edited by mcmunoz; 08-29-2013 at 01:32 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    02-08-2012
    Location
    Newcastle, Australia
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    1,429

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    It does look like quite a long piece of code. Perhaps your computer may be a bit slow? That might be causing the issue. I can't imagine that code taking 3-5 seconds to complete (Probably 2 seconds absolute maximum).

    Can you please upload your workbook with the code in it for me to take a look at in context?

    Thanks

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    Why turn the table headers off and on inside the loop? Also, if you are running 2013, turning sheet protection on and off is much slower.

    How many sheets is a lot?
    Everyone who confuses correlation and causation ends up dead.

  6. #6
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    ajryan - I don't know why it happened. I only got 52 sheets that will change the value. My working station is good.

    Rory - Because some of my sheets have a formula that is why I protect it for other code process. Like importing/embedded another sheet.... 52 sheets need to change the header.

    I don't know if I make myself more complicated doing my work. There is a formula on each table and it was refer to each other that is why I turn on and off the header.

    There is an issue about "header" of the table style that they cannot copy the "date" format same as they are referring with.

    See the attachment below:

    Sample.xlsb

    P.S. Sorry for my grammar.
    Last edited by mcmunoz; 08-29-2013 at 11:18 PM.

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    England
    MS-Off Ver
    365, varying versions/builds
    Posts
    22,015

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    There's no need to do one cell at a time - try this:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    07-17-2013
    Location
    Quezon City
    MS-Off Ver
    Excel 2010 and 2013
    Posts
    75

    Re: VBA Application.EnableEvents and Application.ScreenUpdating

    The lag issue gone now. My minor problem solve now.

    Thank you Rory for your help.

+ 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. Application.ScreenUpdating not working with Application.Run
    By WaqasTariq in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-18-2012, 02:24 PM
  2. application.enableevents
    By Lifeseeker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-26-2011, 07:09 PM
  3. Application.EnableEvents
    By ilovedurango in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2007, 01:19 PM
  4. Application.EnableEvents help
    By Alex in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-18-2006, 02:00 PM
  5. [SOLVED] application.EnableEvents
    By nc in forum Excel General
    Replies: 1
    Last Post: 09-28-2005, 11:05 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