Microsoft Office Tutorials and References
In Depth Information
Chapter 19: Understanding Excel’s Events
In This Chapter
● Recognizing the types of events that Excel can monitor
● Figuring out what you need to know to work with events
● Exploring examples of Workbook events, Worksheet events, Chart events, and
● Using Application events to monitor all open workbooks
● Seeing examples of processing time-based events and keystroke events
What You Should Know about Events
In several earlier chapters in this topic, I present examples of VBA event-handler procedures,
which are specially named procedures that are executed when a specific event occurs. An
example is the CommandButton1_Click procedure that is executed when the user clicks an object
named CommandButton1 stored on a UserForm or on a worksheet. Clicking the button is an
event that triggers the execution of the event-handler VBA code.
Excel is programmed to monitor many different events that occur. These events can be classified
as the following:
h Workbook events: Events that occur for a particular workbook. Examples of such events
include Open (the workbook is opened or created), BeforeSave (the workbook is
about to be saved), and NewSheet (a new sheet is added).
h Worksheet events: Events that occur for a particular worksheet. Examples include
Change (a cell on the sheet is changed), SelectionChange (the user moves the cell
indicator), and Calculate (the worksheet is recalculated).