View Full Version : [SOLVED:] No response to change event
I am learning about event procedures. I cannot understand why the following procedure is not activated when a value is entered in a cell and the cell value is then changed.
Private Sub Worksheet_Change(ByVal Target AS Range)
Dim Col As Long
Dim Row As Long
Co = Target.Column
Row = Target.Row
MsgBox Col
MsgBox Row
End Sub
I am using Excel 2016 with Windows 10.
The workbook Basic Test is attached.
Try executing this code
application.enableevents=true
Or excel application quit & restart
mdmackillop
05-01-2017, 05:37 AM
Nothing wrong with your example. Make sure events are enabled
Sub Enables()
Application.EnableEvents = True
End Sub
Thanks Guys. I added 'Application.EnableEvents = True ' to the Workbook_Open procedure and it cleared the problem.
mdmackillop
05-02-2017, 04:06 AM
In Event code, you may want to set events to False to prevent looping. Use something like this to ensure in the case of an error that Events are re-enabled.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Col As Long
Dim Row As Long
Application.EnableEvents = False
On Error GoTo Exits
Co = Target.Column
Row = Target.Row
MsgBox Col
MsgBox Row
Exits:
Application.EnableEvents = True
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.