The code should be in a standard module not the workbook module.

1/. In Excel press Alt+f11 this will open the VBa editor.

2/. Select the "Insert" tab > Module

3/. Paste all of the given code in the resultant pane/window.

4/. Save the file and close the VBa editor

5/. In Excel (2007) Developer > Macros.... select the one you need then Press "Run"