ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Stops Working (https://www.excelbanter.com/excel-programming/423175-vba-stops-working.html)

egun

VBA Stops Working
 
I have a workbook in which I rely on the Worksheet_Change routine to monitor
user edits. Every once in a while, when I'm working in my edit-test-fix
cycle, the VBA will simply stop responding. I make a change to the
worksheeet that should trigger the code, and nothing happens. I set
breakpoints all over the place, but none of them are ever reached. If I
save, quit Excel and restart, the code works again.

I'm worried that I have introduced bad code or a bug that is causing this.
Does anyone know if this is an Excel issue or is it more likely that I have
some bad code that is causing the problem?

Thanks,

Eric


egun

VBA Stops Working
 
Jeez, never mind, I figured it out. I'm using Application.EnableEvents =
False (and later True) to prevent recursion in the Worksheet_Change routine.
When I stop the code partway through, the events are not turned back on!
That's why the Worksheet_Change event is not triggered afterwards.


JLGWhiz

VBA Stops Working
 
Join the club. <g

"egun" wrote:

Jeez, never mind, I figured it out. I'm using Application.EnableEvents =
False (and later True) to prevent recursion in the Worksheet_Change routine.
When I stop the code partway through, the events are not turned back on!
That's why the Worksheet_Change event is not triggered afterwards.



All times are GMT +1. The time now is 09:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com