+ Reply to Thread
Results 1 to 2 of 2

Worksheet_Change only works once

  1. #1
    Registered User
    Join Date
    08-31-2012
    Location
    hk
    MS-Off Ver
    Excel 2010
    Posts
    2

    Worksheet_Change only works once

    Hi,

    I am trying to recalculate macro functions called from F8:O115 if any value in B2:O4 is changed.
    But the recalculation only works once after compile. The second time I change any value in B2:O4 nothing will happen..

    There must be something wrong in the code below, but I can't figure it out

    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    08-31-2012
    Location
    HCM City, VN
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Worksheet_Change only works once

    Hi,

    I have used your code. It's good.
    I think the second time you change and nothing happen because you played macro in break mode. You can see this in below picture.

    untitled-8.jpg

    In picture, I have played line-6 code in break mode. And I think you have stopped macro before VBA code played line "Application.EnableEvents = True". In this case, your Application.EnableEvents = False so Worksheet_Change event couldn't execute.

    To solve this problem, you should use Immediate Window (Ctrl + G) -> write Application.EnableEvents = True in it -> Enter. After you do this, VBA will enable events to execute. I believe the third time you change any value, Worksheet_Change will work smoothly.
    Last edited by Gervie; 09-01-2012 at 02:14 AM.

+ 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