• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Programming with Events

There are several ways to tell Excel that you want to run a macro. Most of these were discussed in Chapter 29, "Understanding VBA Programming." You can run a macro by choosing the Tools, Macros command, or by pressing a shortcut key you have assigned to the macro. You also can assign a macro to a custom toolbar or menu.

Another way to run a macro is to allow Excel to run it automatically, when some predetermined event occurs. This technique is known as event programming. This system relies upon the built-in events that are recognized by Excel and its object model. You may want to run a macro automatically every time a user opens a workbook, enters a value into a cell, or prints a worksheet. These are examples of the kinds of events your code can respond to.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint