+ Reply to Thread
Results 1 to 12 of 12

Worksheet_Change Not Being Triggered

  1. #1
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Worksheet_Change Not Being Triggered

    I have the following piece of code on my "Summary" sheet in my workbook. Basically if D7 = Total, then it is supposed to run another macro called OrderTypeFilter. If D8 = Total then it should run RxTypeFilter (D7 & D8 are validation dropdowns). Both of the other macros run fine separately, but for some reason if I select Total in the dropdowns in D7 & D8 nothing happens.

    Can anyone see why they are not being triggered correctly? I can't seem to figure it out.

    Please Login or Register  to view this content.
    Similar question also posted on - http://www.mrexcel.com/forum/showthr...=1#post2490599

    Any help is appreciated.

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Re: Worksheet_Change Not Being Triggered

    I think that I may have figured it out...I believe that somehow the events were turned off.

    To turn them back on:

    1 Goto the immediate window (CTRL+G)

    2 Type Application.EnableEvents = True and hit Enter.

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Worksheet_Change Not Being Triggered

    'If Target.Value = "Total"' is case sensitive. Are you inputting Total with a capital "T"?

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Worksheet_Change Not Being Triggered

    I wondered about that.

    You disable/enable event handling in the Change event macro but then go off to other procedures. Could it not make its way back and re-enable the event handling?

    I try to limit the management of events to the immediate vicinity where it needs to be controlled to (try to) avoid this situation.

    Regards

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Worksheet_Change Not Being Triggered

    I assume the code is located on the worksheet's code page rather than in a module?

    I tested it and it seems to work fine for me.

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  6. #6
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Worksheet_Change Not Being Triggered

    Quote Originally Posted by Claymation View Post
    I think that I may have figured it out...I believe that somehow the events were turned off.
    Aye, that would make a big difference

    You need to find out what turned it off and make sure it doesn't happen again by mistake.

    Dom

  7. #7
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,366

    Re: Worksheet_Change Not Being Triggered

    The other issue is that, if you are stepping through code to check/test it, it's easy not to step through to the end. Hence the problem.

    Regards

  8. #8
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Re: Worksheet_Change Not Being Triggered

    Quote Originally Posted by Domski View Post
    Aye, that would make a big difference

    You need to find out what turned it off and make sure it doesn't happen again by mistake.

    Dom
    I think that I am still having some issues with this. I am not sure exactly where it is being turned on/off, but have to go through and manually change it occasionally. Is that portion of the code necessary, or can I just remove it so that I don't end up accidentally changing it?

  9. #9
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Re: Worksheet_Change Not Being Triggered

    Just so that I can be more specific with what I am working with, here is the code that I am using.

    This is the Worksheet_Change on the "Summary" tab:

    Please Login or Register  to view this content.
    Then I have these pieces of code in Module1:

    Please Login or Register  to view this content.
    Any help is appreciated. Thanks.

  10. #10
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Worksheet_Change Not Being Triggered

    If you turn off events, you should always have an error handler so that they get turned back on, no matter what else happens.
    Remember what the dormouse said
    Feed your head

  11. #11
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    199

    Re: Worksheet_Change Not Being Triggered

    Quote Originally Posted by romperstomper View Post
    If you turn off events, you should always have an error handler so that they get turned back on, no matter what else happens.
    I am not sure exactly how I would add that into the code that I have listed above...any help is appreciated.

  12. #12
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Worksheet_Change Not Being Triggered

    For example:
    Please Login or Register  to view this content.

+ 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