I have a long Change Event routine that I’m trying to prevent from running in its entirety; given a couple of specific scenarios.
Essentially I’m trying to limit how much of the Change Event is run when just ANY random cell on the sheet is changed by editing or entering a new value.
I currently have the below code in the Change Event (which just utilises some reverse logic) in that the Change Event will EXIT if the ACTIVE CELL is NOT one of the ones declared (just ANY random one).
If the active cell IS one of the declared cells, then the WHOLE Change Event will run in its entirety.
On testing things my code does appear to do what I was initually intending.
HOWEVER; the code is floored IF I utilise the right click mouse option and use “Clear Contents”
I’ve tried hard to make/create a reference the right click mouse option, “Clear Contents” and exit the routine but I simply can’t get the syntax required.
So I'm after the syntax required to reference the right mouse click for "Clear Contents"
Essentially I’m trying to limit how much of the Change Event is run when just ANY random cell on the sheet is changed by editing or entering a new value.
I currently have the below code in the Change Event (which just utilises some reverse logic) in that the Change Event will EXIT if the ACTIVE CELL is NOT one of the ones declared (just ANY random one).
If the active cell IS one of the declared cells, then the WHOLE Change Event will run in its entirety.
On testing things my code does appear to do what I was initually intending.
HOWEVER; the code is floored IF I utilise the right click mouse option and use “Clear Contents”
I’ve tried hard to make/create a reference the right click mouse option, “Clear Contents” and exit the routine but I simply can’t get the syntax required.
VBA Code:
'All variables have been previously declared
'Eg. Dim BTgt1 As Range, Dim FrwD As Long
'Set BTgt1 = Range("AU" & FrwD - 2)
' etc
'preceding code here:……….
If (ActiveCell = BTgt1 Or ActiveCell = BTgt2 Or ActiveCell = BTgt3 Or ActiveCell =BTgt4) Then
Range("au" & FrwD).Select
Exit Sub
Else
'Code continues with the rest of the Change Event routine