Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a workbook called SAMMY with a worksheet called HOURS. I have
written a VBA sub that manipulates data on this worksheet. The VBA sub is called hx. In the middle of hx, I need to call up a VBA MACRO from the (sometimes closed and sometimes open) workbook called FRED, which has a worksheet called ORDER. The MACRO is currently execured with a button on FRED_ORDER that ties to the Macro: FRED_ORDER.xls!order.order So how do I invoke this Macro from the middle of the sub "hx" on SAMMY? ONE EXTRA IMPORTANT NOTE****: The Macro FRED_ORDER.xls!order.order is completely dependant upon the cursur being on cell A40 on the ORDER sheet in the FRED workbook. If the active cell is not A40 on this sheet/workbook then this Macro won't work (since it needs to "read" the A40 data to determine the next action. So, when I invoke the macro from the SAMMY_HOURS_hx code I need to also some how tell the vba code to get on cell a40 first, before running the order.order, since the order.order macro ASSUMES that one is already there when one runs it from FRED. Whew, that is confusing! I hope it makes sense to one of you genuises! Thnks in advance for the help. I am new to VBA and I am really confused about how to do this! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just a comment on the part quoted below. That macro isn't written correctly,
then. It shouldn't refer to ActiveCell or Selection. If you need to work with cell A40 specifically, the code should say, for example, Range("A40").Offset(1,0) not ActiveCell.Offset(1,0) If you can't correct that, then your code must open FRED_ORDER.xls, activate the Order sheet and select cell A40. Only after doing that can you call the macro in that workbook. As for the command to run it, look at the Application.Run statement in Help. It will show you the syntax. On Fri, 29 Oct 2004 02:36:51 -0400, R wrote: ONE EXTRA IMPORTANT NOTE****: The Macro FRED_ORDER.xls!order.order is completely dependant upon the cursur being on cell A40 on the ORDER sheet in the FRED workbook. If the active cell is not A40 on this sheet/workbook then this Macro won't work (since it needs to "read" the A40 data to determine the next action. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Running macro in another workbook | Excel Worksheet Functions | |||
Workbook running VERY slow | Excel Discussion (Misc queries) | |||
Help:Running a macro in one excel workbook from another workbook | Setting up and Configuration of Excel | |||
Running a macro in another workbook | Excel Programming | |||
Running macros from another workbook | Excel Programming |