Event procedures - VBA For Excel

We have seen examples of events in this chapter. For example,Click the event that is activated when a Command button is clicked. Other events occur in Excel, for example, when a workbook is opened, or when a new worksheet is created, or when a chart is printed. The VBA programmer can write code that activates whenever an Excel event of the type just described occur.This code is placed in an event procedure. There are many event procedures that can be used too many for coverage in this book, and therefore we will look only at a couple of examples here. There are, excluding control events discussed earlier, four objects in Excel that can contain events.They are:

  • Worksheet
  • Chart
  • Workbook
  • Application.

Not all events are defined by all objects. In general,however, if an object has an event,its parent object will also have the same event. For example, the Change event is contained at the lowest level by the worksheet object, and its parent (the workbook object)also has this event,called Workbook_Sheet Selection Change. In turn, the workbook object s parent, the application, also has a Change event.(Application-level events work slightly differently than other events.)Note also that Chart events only apply to Chart sheets, and not to Chart objects embedded in sheets.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

VBA For Excel Topics