Are events useful

At this point, you may be wondering how these events can be useful. Here's a quick example.

Suppose you have a workbook that other people use for data entry. Any values entered must be greater than 1,000. You can write a simple macro that Excel executes whenever someone enters data into a cell. (Entering data is an event.) If the user enters a value less than 1,000, the macro displays a dialog box reprimanding the user.

The DataO Validation command in Excel provides another way to perform this type of data-entry checking — without even using VBA. However, as you see later in this chapter (see "A data validation example"), using VBA for data validation offers some distinct advantages.

This is just one example of how you can take advantage of an event. Keep reading for some more examples.

0 0

Post a comment