What Would Prevent A Worksheet Change Event From Triggering

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Although I do use mbevents true/false to control whether or not macros trigger during cell change prompted worksheet changes. In this case mbevents equals true so worksheet change events should trigger.
I can't share all my code, so I've attached my workbook.
To recreate, open the "FORM" page. Press reset. (The page is supposed to clear to default when the sheet is activated but thats a different problem.)
Enter a numeric value in cell E2. Tabbing out should trigger the worksheet change event for cell E2. But it doesn't. It reveals a cell validation list dropdown in cell K8 (which is hidden by a shape revealed with proper process).

I have a stop command at the start of the worksheet change module but it doesn't get to that point. Something is happening when the user changes the value in E2 that isn't initiated by the worksheet change module.
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
The stop is triggering for me, 3 presses of f8 exits the procedure via If Not mbevents Then Exit Sub

What does Debug.Print Application.EnableEvents in the immediate window tell you?
 
Upvote 0
Hi jasonb.

When I run the same process you are encountering the stop with, I continue to get no stop.
Immediate window results are FALSE. But watching the value of mbevents reveals a value of TRUE.

Truly puzzling.
 
Upvote 0
I restarted Excel and it appears to be working. I'm not sure if I've coded something wrong that might eventually create that problem again or not.
Time will tell.
 
Upvote 0
Application.EnableEvents and mbevents are not the same.

The first is an application level setting, the second is a declared variable. If Application.EnableEvents has been set to False then events will not fire regardless, mbevents can override Application.EnableEvents = True, but not Application.EnableEvents = False

Check all of your code for the line Application.EnableEvents = False if you set it to false while something runs, then you need to set it back to true when it finishes. If you hit an error and end your code before it is set back to true then you need to reset it manually, by entering Application.EnableEvents = True into the immediate window.
 
Upvote 0
Thanks jasonb.
A search for Application.EnableEvents came up negative in this workbook.
That setting wouldn't still reside in Excel after another workbook that used Application.EnableEvents was closed would it? I think I know the answer, but I could be wrong.
 
Upvote 0
Application.EnableEvents as the name suggests, is set at application level, so a change in any workbook affects excel as a whole, not just that one workbook.

So if you have Book1 and Book2 open, setting it to False in Book1, then closing Book1 will mean that it is still false for Book2. If you subsequently open Book3, it will be False there as well.

You would either need to set it back to True in vba, or completely close and reopen excel.
 
Upvote 0
Thanks Jason. That may have been the issue then.
 
Upvote 0

Forum statistics

Threads
1,214,904
Messages
6,122,169
Members
449,070
Latest member
webster33

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top