How can an Excel Add-In respond to events in any worksheet?

Don’t use the New keyword in the dim statement. You’re telling it to instantiate the class when it’s needed, but then you never refer to it again, so it’s never needed. Instead:

Public MySheetHandler As SheetChangeHandler

Sub Auto_Open
   Set MySheetHandler = New SheetChangeHandler
End Sub

That line in the Auto_Open (which runs at startup) will instantiate the class.

Leave a Comment