Worksheet_Change Never FIres
events, excel, vba
Solution
Do you have more than one sheet? Be aware that the sheet's CodeName property and the Name property (the name on the tab in Excel) aren't always the same. For instance, if the Project Explorer lists
Sheet2 (Sheet1)
Then Sheet1 is the Name and Sheet2 is the CodeName.
The easiest way to see if you have put the code in the wrong module is to right click on the sheet's tab and choose View Code. That will bring up the CodePane for that sheet and that's where your code should be.
Problem
I am using VBA to alter Excel and have the following simple event handler inside the Sheet1: ``` Private Sub Worksheet_Change(ByVal Target As Range) MsgBox "HI" End Sub ``` This never fires though, ever. I have tested in the Immediate Window: ?Application.EnableEvents which ultimately returns True, so it should fire. Does anyone know why this doesn't want to fire at all?