vba Sub Worksheet_Change not working

EasyEd

New Member
Joined
Oct 23, 2010
Messages
4
An Excel program hung up on me and wouldn't reload, so I rebooted my computer. But now the Excel VBA subroutine 'Private Sub Worksheet_Change(ByVal target As Range)' doesn't work (it worked fine before the hangup)! The sub doesn't run even if I copy and paste it into a new workbook; it never gets activated (if I insert a breakpoint it's never recognized). I'm concerned that my Excel program might be corrupted, but I'm hoping that something changed that I can reset.
Any thoughts on how I can correct this?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
In the Visual Basic Editor immediate window (CTRL+G), type in the following code and press enter:
Code:
application.EnableEvents=True
 
Upvote 0
In the Immediate Window of the VBE (in the VBE, Ctrl+G to open it) type:

?Application.EnableEvents

If it returns False, this shows that events have been disabled. Renable them with the following command:

Application.EnableEvents = True
 
Upvote 0
first try running this code
Code:
Sub i()
Application.EnableEvents = True
End Sub
 
Upvote 0
Hi Richard,

I am in the same boat as EasyEd had been in. Slight difference is that I cannot get EnableEvents activated, not even applying your solution after checking the status with ?Application.EnableEvents method.
The strange is which conditions it happens with: I have a Worksheet_SelectionChange macro applied on the sheet. It triggers many public functions; in all of them I set EnableEvents = True before End. So I do in SelectionChange macro. And it works perfectly! But when I delete a value in a cell, and then change the selection, nothing happens: the deletion sets the EnableEvents to False... so after deletion the SelectionChange never works again.
Can I kindly ask for advice?
Additionally, WorkSheet_Change function does not work in this workbook, God knows the reason why. I figure it might be related to the issue with SelectionChange - or am I completely wrong?

Thank you, Laszlo
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top