The information in this article applies to:
SUMMARYThe GOTO macro function branches from the currently running macro and runs the sequence of macro commands at the line or defined name within the GOTO parameters and does not return. The RUN macro function proceeds to run the macro commands at the location specified within the RUN parameters, and when the =RETURN() line is encountered, returns to the macro line immediately following the RUN macro function and finishes running that macro. MORE INFORMATION
Consider the following examples of the GOTO and RUN functions:
When you run this macro at A1, Microsoft Excel generates an alert message showing "this is the first set." Then it branches to line A6 and displays the alert message "this is the second set." Microsoft Excel then jumps to line A11 and displays the alert message "welcome to this third set". When it encounters the =RETURN() command at A12, Microsoft Excel jumps back to A8 and displays the alert message "welcome back to the second set." When it executes =RETURN() at A9, the Microsoft Excel macro program stops and does not go back to A3 and continue. The GOTO command is a branch command that breaks off running the rest of lines immediately following and executes a separate routine of macros. To return to a macro that broke off as a result of a GOTO command, you need to place another GOTO to return back. This extra step can be eliminated by using the RUN command. NOTE: This is also true for version 5.0 macro sheets, but not modules. REFERENCES
"Online Help," version 5.0 Additional query words: 2.0 2.00 2.01 2.1 2.10 2.2 2.20 2.21 3.0 4.0 5.0
Keywords : |
Last Reviewed: July 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |