Microsoft Excel macros can replace tedious functions in Excel spreadsheets. For example, instead of typing the same information over and over again, you can create a macro to do the work for you. Macros are workbook specific, which means that if you want the macro in one workbook to work in another workbook, you have to copy the macros over. Copying a macro can be done through the Visual Basic Editor (VBE), which is built into Excel.
Open the workbook that has the macro you want to copy.
Press the "Alt" and "F11" keys together to access the VBE.
Click on the name of the macro you want to copy in the left-hand column. This opens up a window with the Visual Basic for Applications (VBA) code.
Click on the "Edit" tab and then click on "Select All."
Click on "Ctrl" and "C" to copy the macro to the Office Clipboard.
Open the workbook where you want to copy the macro to.
Press the "Alt" and "F11" keys together to open the VBE.
Click on "Insert" and then click on "Module" to open a blank window.
Click inside the blank window, then press the "Ctrl" and "V" keys to paste the code into the open window. Your macro is now copied and ready for use.
Press the "Alt" and "F11" keys together to exit the VBE and return to your workbook.
When you save your workbook, the macro is automatically saved along with the workbook contents.
Tips and warnings
- When you save your workbook, the macro is automatically saved along with the workbook contents.
Things you need
- Excel 2007 or Excel 2010