Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

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

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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!

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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.
    _________________
    [b] Mark O'Brien

    [ This Message was edited by: Mark O'Brien on 2002-03-28 07:59 ]

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    25
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    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!

  4. #4
    New Member
    Join Date
    May 2011
    Posts
    13
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default 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

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •