View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Macros: can you copy macros from one doc to another?

It is ok to copy macros. You just can't reference the specific workbook name
usch as book1.xls because each file has a different name. Use Thisworkbook
to reference the workbook where the macro is located. Or get the name by
using thisworkbook.name.

You also must have the same sheetnames if you are referencing the sheets by
there actual names. If the code is failing you should get the failed line
highlighted and an error message. Posting the error and the highlighted line
will help solve the problem.

"Roady" wrote:

Hello: I have recorded 3 different macros in an Excel document. Problem is, I
already have 4 different other "working" copies of that document out there. I
wanted to enhance the other working copies with the macros so I copied and
pasted the macros into the other documents. Is this ok to do? It seems like
it is performing the macros but it keeps giving me an error message. In
addition, whenever I open a document and check the macros names, it always
lists the same ones. Does that mean that I have to re-name the macros or
recreate the macros in each working copy instead of copying? I am concerned
that it feeds back to the original document. Thank you!