From the "Tools" pulldown menu, select "macro" > "macros". When the macro window pops up, select "Create", give it a name and then press "ok". The new Macro will now be listed. Select it and then choose "edit". Paste the Macro text, save and close the editor window.
Then just select it again from the list and press "Run".
You can also create a toolbar and icon for the macro.