ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro in sheet (https://www.excelbanter.com/excel-programming/367815-macro-sheet.html)

chalky[_17_]

Macro in sheet
 

Ok i have a macro that is written in a template workbook. The idea i
that the template is then copied into a variety of sheets and the macr
is run to pick up various pieces of standing data, what i am strugglin
with is a way of ensuring the macro stays with the sheet when it i
copied into a new work book.

Any ideas

--
chalk
-----------------------------------------------------------------------
chalky's Profile: http://www.excelforum.com/member.php...fo&userid=2375
View this thread: http://www.excelforum.com/showthread.php?threadid=56329


Tom Hutchins

Macro in sheet
 
Put the macro inthe code module for the sheet that will be copied to the
other workbooks. The macro will be copied with the sheet.

If your macro is a user-defined function which is called from the worksheet,
the code must be in a VBA code module. The following link to Erlandsen Data
Consulting's VBA site has code for copying a module from one workbook to
another:

http://www.erlandsendata.no/english/...vbavbecopytowb

Hope this helps,

Hutch

"chalky" wrote:


Ok i have a macro that is written in a template workbook. The idea is
that the template is then copied into a variety of sheets and the macro
is run to pick up various pieces of standing data, what i am struggling
with is a way of ensuring the macro stays with the sheet when it is
copied into a new work book.

Any ideas?


--
chalky
------------------------------------------------------------------------
chalky's Profile: http://www.excelforum.com/member.php...o&userid=23758
View this thread: http://www.excelforum.com/showthread...hreadid=563293




All times are GMT +1. The time now is 10:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com