how to copy a macro into another file

H

Heather

Can someone assist me...I am trying to copy a macro into
another file by following the instructions and it will not
allow me to drag the macro into my new file. Am I doing
something wrong or is there something wrong with the way I
saved my macro? Thanks
 
D

Dave Peterson

I'm not sure what you're doing, but you can just highlight your code, copy it,
and the paste into a module in that other workbook.

If both workbooks are open, you can actually drag a module in one project to a
different project.

Inside the VBE, hit ctrl-r to see the project explorer.

Expand the "sending" project until you see the module you want to copy.

click and drag, and then release over the "receiving" project.
 
G

Guest

I am a novice at these macros - do I have to have VBE open
in the other file to do this?

But yet when I open the file I am trying to copy the macro
into and check VBE - the macro is there BUT when I try to
run it it gives me an error say "COMPILE ERROR: ARGUMENT
NOT OPTIONAL" - What does that mean?
 
D

Dave Peterson

I think it would be easiest if both workbooks were open in the same instance of
excel.

That would mean that the projects are open in the same instance of the VBE.

And as a first guess, it sounds like you're using a function that has a name of
a built in function.

But I bet it could be other things, too.

You may want to post more info (including the code??)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top