Hello moraalg,

This code needs to be a VBA Module.
  1. Copy the macro with Ctrl+C.
  2. Open the workbook and use Alt+F11 to open the VB Editor.
  3. Use ALT+I to display the Insert Menu.
  4. Press the M key to add a new Module.
  5. Paste the macro into the Module with Ctrl+V.
  6. Save the macro using Ctrl+S