How do I "move" a macro from one worksheet to another?

CRF

New Member
Joined
Mar 26, 2002
Messages
25
We are jointly working on a template workbook. I have created a macro & worksheet that need to be pasted into another workbook. When I try to insert/module and paste macro into another workbook - it still launches my original workbook and runs the macros from there. Help!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Is your macro in a module or on the workbook object? I'm guessing it's in a module since your calling it a macro.

My advice is to go to the macro, select all and then copy. Go to the sheet that you're exporting, right click on the Name TAB, choose "View Code" and then paste your macro code into the VBE window that comes up.

HTH

Actually, do you want to post the code that you use to call your macro. That might be helpful.
_________________<font color = green> Mark O'Brien
This message was edited by Mark O'Brien on 2002-03-28 07:59
 
Upvote 0
Thanks - I pasted into Viewcode and moved sheet to new workbook. Got error message. Pasted to VB windows as Thisbook. Then edited each button and reassigned macro. Then it worked without calling my other workbook. Muchos Gracias!
 
Upvote 0
Re: How do I "move" a macro from one worksheet to another?

Actually you can export it.

At the top left pane of the Visual Basic Editor (ALT + F11), highlight the module, and right click and select EXPORT.

Open the destination workbook and from FILE select IMPORT. Save the time in copy and pasting.

HTH
Henry
 
Upvote 0

Forum statistics

Threads
1,213,538
Messages
6,114,218
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top