Copy Code to Your Excel Workbook

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.

 

_________________

You may also like...

3 Responses

  1. Eric says:

    Debra!

    Are you hiding any other blogs? I am glad to find out about the pivot table blog!

    Cheers,

    Eric

  2. Stephanie says:

    Hi, I want to use your multiple selection drop down menu code in a worksheet that already has code in it. I’m not sure how to add it in. In fact, the worksheet is the data entry form I found on this website. I’m using the input sheet to create a survey. Now I just want to be able to allow multiple selections per response. I’m don’t know much about vba. Could you help?

Leave a Reply

Your email address will not be published. Required fields are marked *