How to Link an Excel Worksheet to a Macro SheetLast reviewed: November 2, 1994Article ID: Q32317 |
The information in this article applies to:
SUMMARYThe information below tells how a macro places a calculated value from a macro sheet onto a worksheet. Before starting, you should know the following:
MORE INFORMATIONThe macro in the example below brings up a dialog box and allows a numeric value to be entered. The macro then takes this entered value and places it on the worksheet. You cannot have your worksheet get a value from your macro sheet by using a simple link. Your macro must go out and place the value on the worksheet. For example, try a sample dialog box range on a macro sheet named "Mine.XLM" in cells B6:H7, with the following entries.
B6: 6 C6: 0 D6: 0 E6: 0 F6: 200 G6: 50 B7: 7 C7: 0 D7: 40 E7: 15 F7: 130 G7: 20Note: The Init/Result cell in this case is cell H7 of the macro sheet. The code for a macro to place a value in cell A1 of a worksheet named "Yours.XLS" then reads as follows:
=DIALOG.BOX(B6:H7) =ACTIVATE("Yours.XLS") =SELECT(!A1) =FORMULA(Mine.XLM!$H$7) =RETURN() REFERENCES"Microsoft Excel Functions and Macros," version 2.x, pages 204-218 "Microsoft Excel User's Guide," version 3.0, pages 625-638
|
KBCategory: kbusage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |