+ Reply to Thread
Results 1 to 3 of 3

Macro triggers event and leads to error

  1. #1
    Registered User
    Join Date
    09-21-2010
    Location
    Toronto, ON
    MS-Off Ver
    Excel 2007
    Posts
    21

    Macro triggers event and leads to error

    Hi,

    I currently have a workshet event that checks if a value entered a cell exists. It's quite simple and looks something like this (I've tried to remove the superfluous parts):

    Please Login or Register  to view this content.
    I have another macro that clears the values entered into the aforementioned cells and looks like this:

    Please Login or Register  to view this content.
    The two codes run fine indipendantly of each other but, with them both in my code, I guess a type mismatch everytime the macro 'clear' runs. I'm sure there's a reasonable explanation as to why this is happening but I'm stumped.

  2. #2
    Forum Expert Tsjallie's Avatar
    Join Date
    09-15-2012
    Location
    NL
    MS-Off Ver
    2010, 2013, 2016
    Posts
    2,077

    Re: Macro triggers event and leads to error

    Without the workbook it's hard to say what's the problem.
    But it could well be that the Worksheet_Change sub is triggering the change event and thus calling itself endlessly.
    Try to disable event handling at the start of the procedure and switch it back on in the end.
    Something like this:
    Please Login or Register  to view this content.
    Cheers!
    Tsjallie




    --------
    If your problem is solved, pls mark the thread SOLVED (see Thread Tools in the menu above). Thank you!

    If you think design is an expensive waste of time, try doing without ...

  3. #3
    Registered User
    Join Date
    09-21-2010
    Location
    Toronto, ON
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Macro triggers event and leads to error

    Awesome. Disabling events worked.

    Thanks a ton for the quick response

+ 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