Macros, also called procedures, or subs, can perform virtually any task. They can b e used for clearing cells in an area of a w orksheet, or sorting a list of items before printing it, and a multitude of other things. As programs become longer and more complex, so it becomes necessary to break them down into smaller parts where each part performs a specific task. There will usually be a main task which might then activate, or call, other tasks when necessary. This is known as modular programming and VBA facilitates this approach. For example, a complex sub can be made simpler by accessing or 'calling' another sub. The following example shows how this is done.

0 0

Post a comment