Excel: Button Fails to Run Correct Macro

Last reviewed: November 2, 1994
Article ID: Q67462

SUMMARY

When a Microsoft Excel macro is assigned to a worksheet button or a worksheet item, it must be assigned as either an absolute reference ("Macro1!$A$1") or a name ("Macro1!My_Macro"). Assigning the macro to a relative reference ("Macro1!A1") may cause the macro to produce an error, the macro to run incorrectly, or the wrong macro to run.

When relative references are used, Excel must locate the macro to be run relative to the active cell (the currently selected cell on the worksheet). Therefore, if a button is assigned to Macro1!A1, and A1 is highlighted on the worksheet, the macro will run normally. However, if B1 is highlighted on the worksheet, Excel will search for a macro at Macro1!B1.

For more information on worksheet buttons, see page 584-589 of the "Microsoft Excel User's Guide" version 3.0 manual.


KBCategory: kbother
KBSubcategory:



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 2, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.