ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Change in cell disabling events (https://www.excelbanter.com/excel-programming/411388-change-cell-disabling-events.html)

J Streger

Change in cell disabling events
 
I have a worksheet that has two events, shown below:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

If Not StartEvent Then Exit Sub

WBSFinalWorksheetChange Target

EndEvent

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Force a calculation
Application.Calculate

End Sub

The SelectionChange event has the calc so that a custom function updates
that's based on the current selection. The worksheet change event has a
startevent and endevent function, which turns off and on screenupdating,
interactivity, calculations, and events, respectively. My problem is that I
make sure events are on, then select a cell (firing off the selection change
event) and then change the value of the cell. Events turn to false. No code
is run (I have a breakpoint on both events) and I have breakpointed every
place I set the enableevent property in my code and non of those lines run.
Somehow events are turning off just by me changing a value on a sheet and I
have no idea why. Any ideas?


--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

User of MS Office 2003


J Streger

Change in cell disabling events
 
I found out my problem. Kind of.

it seems that the code is NOT stopping at the breakpoints and is still
running (as I dropped msgboxes into the code). So why would the code no
longer stop at breakpoints that I place?

--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

User of MS Office 2003



"J Streger" wrote:

I have a worksheet that has two events, shown below:

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)

If Not StartEvent Then Exit Sub

WBSFinalWorksheetChange Target

EndEvent

End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Force a calculation
Application.Calculate

End Sub

The SelectionChange event has the calc so that a custom function updates
that's based on the current selection. The worksheet change event has a
startevent and endevent function, which turns off and on screenupdating,
interactivity, calculations, and events, respectively. My problem is that I
make sure events are on, then select a cell (firing off the selection change
event) and then change the value of the cell. Events turn to false. No code
is run (I have a breakpoint on both events) and I have breakpointed every
place I set the enableevent property in my code and non of those lines run.
Somehow events are turning off just by me changing a value on a sheet and I
have no idea why. Any ideas?


--
*********************
J Streger
MS Office Master 2000 ed.
MS Project White Belt 2003

User of MS Office 2003



All times are GMT +1. The time now is 05:06 AM.

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