To use the code you found on the website:
In the Visual Basic editor, on the left hand side under
Project-VBA Project, go to where it says
VBAProject (<Your workbook name here>) and under
Microsoft Excel Objects double click one of the sheets, and a blank code file will open up.
On the dropdown on the left side, select
Worksheet and then select
SelectionChange on the right, fill in the code from the website you linked. This is an event driven subroutine, which means when you change the selection, this code will be run automatically.
For a private subroutine that's not event related, create a public
Calls the private one.