You might find Excel code on this blog, or my Pivot Table blog, and want to copy it into your own workbooks.
I've updated my web page, Adding Code to an Excel Workbook, to show instructions for Excel 2010. There's a new video too, that shows how to
- copy Excel code from the internet
- insert a code module in Excel
- paste the code into the module
- run the new macro
- save the file as macro enabled
You can watch the video here, to see the steps. The sample pivot table code in the video was copied from the Excel Pivot Tables blog: Change All Pivot Table Value Fields to SUM
NOTE: For the Excel 2003 version of the Copy Code tutorial, please visit: Copy Code to Excel 2003 Workbook
Modify the Code
It's not always so simple to copy Excel code, and use it in your workbooks. You might have to modify the code, by changing worksheet names, or cell references, to match what is in your file.
For example, if you copy my code for multiple selections from an Excel drop down, you might have your data validation cells in a different column. You could change the column number in the code, as shown in the following video.
Note: This code goes on a worksheet module, instead of a regular module.