+ Reply to Thread
Results 1 to 6 of 6

Worksheet change macro takes too much time when run with update list macro

  1. #1
    Forum Contributor
    Join Date
    08-01-2007
    Posts
    110

    Worksheet change macro takes too much time when run with update list macro

    Hi there Everyone! I have a problem with one of my worksheets. The problem is the following:
    I have a worksheet in which I have a worksheet_change macro. This worksheet_change macro makes sure that a few cells will keep their colors, even if the user copies and pastes a new value to that cell. This worksheet_change macro runs each time there is a change on the worksheet. Now my problem is that on the same sheet I have an update list macro which updates around 20.000 rows and two columns (which is alltogether around 40.000 values) and it takes a while to run. So.. it takes a loooooooooot of time (too much) when these two macros both run. My question is that can I somehow disable the worksheet_change macro while the update list macro runs. I mean something like when I start the update list macro to disable worksheet_change macro and when the update list macro finishes, then reenable worksheet_change macro?
    Thank you in advance for your help!
    Last edited by hunsnowboarder; 02-01-2009 at 10:32 AM.

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Worksheet change macro takes too much time when run with update list macro

    check out Application.EnableEvents (be sure to reset to True in an Error Handler), however, you may also want to look into tweaking your Change event such that it only fires for cells within a given Intersect (if not already).

  3. #3
    Forum Contributor
    Join Date
    08-01-2007
    Posts
    110

    Re: Worksheet change macro takes too much time when run with update list macro

    HI DonkeyOte! Thanks a lot for your comment! This is what I want, I am sure! But please could you explain me how to do it as I am very very new to VBA! Both solutions would be good for me!

    I think the best solution would be when worksheet_change macro activates only if there is a change in a given range (in my case 3 cells: G2, A2 and A11). Could you help me in that?

    Thank you!

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Worksheet change macro takes too much time when run with update list macro

    Your post does not comply with Rule 5 of our Forum RULES. We have Seven question forums: Miscellaneous, General, Programming, Worksheet Functions, Charting, Excel 2007 Help and New Users. Please choose the appropriate forum, and post your question in ONLY one forum.
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  5. #5
    Forum Contributor
    Join Date
    08-01-2007
    Posts
    110

    Re: Worksheet change macro takes too much time when run with update list macro

    Ok VBA Noob! I think you are picking on me for something. Yes, I made a few mistakes (cross posting) in the beginnig, but (in my last posting you have also added a comment which was just to toss me) I see that now you will be allways commenting my post. This posting I put in the worksheet function forum because IT IS a worksheet related post. I think it is better for me and for you as well, if I will post no more on this site. I would like to thank you and all for your help in the past! Thank you for everything and wishing you all the best!

  6. #6
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988

    Re: Worksheet change macro takes too much time when run with update list macro

    Your title mentions the word macro twice and you also refer to a Worksheet change macro which in my book should be under programming.

    Happy for you to post here as long as you follow the rules which you seem to be having a problem with.

    PS Don't bother to thank me for moving it for you

    VBA Noob

+ 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