View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default HELP! Macro FAILS when I copy the worksheet...

It sounds like you are using a button from the Forms Toolbar. Use a
commandbutton from the control Toolbox Toolbar and put your code in the
click event of the commandbutton (found in the sheet module).

--

regards,
Tom Ogilvy


"Chris M" wrote in message
...
I have a macro (does simple formatting) that I need to leave in the

worksheet
object (NOT in a module). Reason for this is that I'm anticipating users
needing to copy the worksheet into another file/new file. I need the

macro
to continue to work within ANY copied worksheet, whether in the same

original
file or in a separate file, INDEPENDENT of the original worksheet/file or

any
other worksheet. The user will CLICK a BUTTON on the worksheet to run the
macro.

PROBLEM: though the macro is carried with the worksheet (which is good),
the macro won't execute correctly, or at all (ie, the BUTTON no longer
works). When the BUTTON is clicked, the program either tries to open the
original file where the macro was built, or simply bombs out (error code

of
400).

How do I ensure that when I click a "button" on the worksheet that the

macro
assigned to it will ALWAYS work no matter where/how many times the

worksheet
is copied?

THANKS FOR ANY HELP!!!


Chris M