JuliusUmulius
New Member
- Joined
- Mar 22, 2015
- Messages
- 9
Hello guys and gals. I got this weird situation that I hope someone can help me resolve. I have tried a lot of googling, but am unable to find a solution. The web is flooded with people not understanding Application.EnableEvents, so it is a bit difficult to find relevant information. I can assure you that EnableEvents is indeed turned on, so that is not the issue.
The case is this: I got this complex Excel application with several worksheets. In one of these worksheets I have Worksheet_BeforeDoubleClick, Worksheet_Change and Worksheet_SelectionChange events.
All of them worked fine until suddenly I began having problems with the Worksheet_Change event:
1. Breakpoints doesn't work any more when I change values in cells or paste. But if I clear values (press delete) it does.
2. Even with breakpoints inserted, some code below breakpoints run. Like debug.print.
3. I have, by thorough debugging, noticed that the procedure suddenly exits at some point without any obvious reason. In one occasion it just ended after
, not continuing to the following line which was
.
What I am trying to do is to capture any paste operations and clean out the formatting. The other procedures within the Worksheet_Change event is very simple and seems to work just fine.
I have tried cleaning the workbook with Clean VBA Project from Ribbon Commander. Although it seems to solve some stability issues, it doesn't manage to solve this.
I have also tried to comment out all other events, parts of the code, deleting the code and build it up again from scratch, compiling the code from the Debug menu, etc... I just can't seem to kill this bug.
Any help is deeply appreciated. Thanks.
The case is this: I got this complex Excel application with several worksheets. In one of these worksheets I have Worksheet_BeforeDoubleClick, Worksheet_Change and Worksheet_SelectionChange events.
All of them worked fine until suddenly I began having problems with the Worksheet_Change event:
1. Breakpoints doesn't work any more when I change values in cells or paste. But if I clear values (press delete) it does.
2. Even with breakpoints inserted, some code below breakpoints run. Like debug.print.
3. I have, by thorough debugging, noticed that the procedure suddenly exits at some point without any obvious reason. In one occasion it just ended after
Code:
Application.ScreenUpdating= True
Code:
Application.EnableEvents = True
What I am trying to do is to capture any paste operations and clean out the formatting. The other procedures within the Worksheet_Change event is very simple and seems to work just fine.
I have tried cleaning the workbook with Clean VBA Project from Ribbon Commander. Although it seems to solve some stability issues, it doesn't manage to solve this.
I have also tried to comment out all other events, parts of the code, deleting the code and build it up again from scratch, compiling the code from the Debug menu, etc... I just can't seem to kill this bug.
Any help is deeply appreciated. Thanks.