Page 230 - CITS - Computer Software Application -TT
P. 230

COMPUTER SOFTWARE APPLICATION - CITS






























           How to copy a macro to another workbook

           You created a macro in one workbook and now want to reuse it in other files too? There are two ways to copy a
           macro in Excel.
           Copy the module containing a macro

           In case the target macro resides in a separate module or all the macros in the module are useful for you, then it
           makes sense to copy the whole module from one workbook to another:
           1  Open both workbooks - the one that contains the macro and the one where you wish to copy it.

           2  Open the Visual Basic Editor.
           3  In the Project Explorer pane, find the module containing the macro and drag it to the destination workbook.
           In the screenshot below, we are copying Module1 from Book1 to Book 2.

























           Copy the source code of a macro
           If the module contains many different macros while you need just one, then copy only the code of that specific
           macro. Here's how:
           1  Open both workbooks.
           2  Open the Visual Basic Editor.

           3  In the Project Explorer pane, double-click the module containing the macro that you'd like to copy to open its
              Code window.



                                                           217

                             CITS : IT&ITES - Computer  Software Application - Lesson 63 - 77
   225   226   227   228   229   230   231   232   233   234   235