Eliminating those pesky alert messages

As you know, a macro can automatically perform a series of actions. In many cases, you can start a macro and then go hang out at the water cooler while Excel does its thing. Some operations performed in Excel, however, display messages that require a human response. For example, if your macro deletes a sheet, Excel displays the message shown in Figure 14-3. These types of messages mean you can't leave Excel unattended while it executes your macro.

Figure 14-3:

You can instruct Excel to not display these types of alerts while running a macro.

To avoid these alert messages, insert the following VBA statement in your macro:

Application.DisplayAlerts = False

When the procedure ends, Excel automatically resets the DisplayAlerts property to True (its normal state).

0 0

Post a comment