The VBA Editor will automatically insert the correct procedure declaration. (You can, however, create custom events for your own classes. There are many events that are defined in a Worksheet object, the Workbook object, and the Excel Application object itself.On this page, we will cover Application events in only in general terms, but not in much detail since they require a different coding model.If you are programming with your own custom classes, you can extend the functionality of these classes by defining and raising your own custom events, broadcasting the event message to any object that is listening for events from your class.Events and Event Procedures were introduced in Excel97. Events and event procedures are the same for versions 97 through 2007.Event procedures must be declared exactly as they are defined.This is why it is good practice to let the VBA Editor insert your procedure shell. Getting Started With Events The easiest way to start with events and event procedures is to allow the VBA editor to build the shell code for you.An and always in the code module of the worksheet, whenever the value of any cell on the worksheet is changed by user input or by other VBA code (but not if the change in value is a result of a formula calculation). The events and their procedure declarations are fixed.
There is no direct way to determine whether the cause of the event was user input or VBA code.
Events on Charts are a special case of events and need special code handling.
OBJECT MODULES -- Everything related to event handling -- the definition of event procedures, creating a Learning What Events Are Available For An Object You can use the Object Browser in the VBA Editor to determine what events are avaiable for the three objects that generate events -- the Worksheet, the Workbook, and the Application.
(See the notes on Chart Objects and Charts in the blue box in the objects.
For help on a particular object or event, select it in the Object Browser and press F1 for Help on that topic (note that not all events are documented -- you may have to access event information by going through the object to which the event belongs.