CHAPTER 46
Working with Excel Events
In the preceding chapters, we presented a few examples of VBA event-handler procedures for ActiveX controls. These procedures are the keys to making your Excel applications interactive. This chapter introduces the concept of events for Excel objects and includes many examples that you can adapt to meet your own needs.
Understanding Events
Excel monitors a variety of events and can execute your VBA code when any of these events occur. This chapter covers the following types of events:
- Workbook events These occur for a particular workbook. Examples include
Open
(the workbook is opened or created),BeforeSave
(the workbook is about to be saved), andNewSheet
(a new sheet is added). You must store VBA code for workbook events in theThisWorkbook
code module.Worksheet events These occur for a particular worksheet....