This is done on Mac office Excel ver.15.31 but I assume the process would be much similar if you on PC and the Excel version isn’t that old.
Follow the menu selection,
Tools–>Macros–>Visual basic editor
Then below window will pop up and you just paste the code, update the Column letter where you have the email lists. Highlighted on the image below. Then click the |> button