For Office 365, please add one more line in the beginning.
We need to activate the developer tab from File>Options>Customized_Ribbon
Then this Macro is to be added to the 'view_code' window
Make it operable in all sheets from the left pane,
And convert file to xlsm format for the macro to be enabled.