• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Move/ Copy macro assiged to a shape from one excel to another excel

Naveen N

Member
Hi,

I have a macro assigned to a shape in a excel sheet say “Introduction”. I have provided some input data in some cell in the Introduction.

I copy the excel sheet (Introduction sheet) using move/ copy to another excel. I am able to run the macro by clicking on the shape.

Whenever I open the excel, I get a update link message.

Is there a way to copy macro code when we move the macro assigned to a shape ?


Please suggest the best way to handle this situation.

Regards,

Naveen N
 
Hi Naveen,

You would want to have to macros stored within the Sheet module of the sheet that is getting copied. Usually, macros are stored in a regular module, which does not "travel" with the sheet. In image, the sheet module is highlighted
upload_2015-5-26_8-39-41.png

So, open your VB editor, find the macro of interest (probably in the regular module), and cut-paste it into the sheet module. Now, when you copy the sheet somewhere else, the code will go with it.
 
Don't forget to save the new workbook as an Excel macro (*.xlsm) or Excel Binary file type (*.xlsb)
 
Hi,

Thanks for the inputs and sorry for the delay in response.

I tried the approach,
now the issue is I have macros on each sheet. When I copy a sheet into a
new workbook, the macro comes with it, but the button on the sheet still
points to the macro in the original workbook. You have to right mouse click
"Assign Macro" and choose the macro in the current workbook.

I mail this to my team and this creates a issue, please suggest how to solve the issue.

Regards,
Naveen N
 
Back
Top