That code is for a worksheet event and goes in the sheet module not a standard module.
Right click on the sheet tab and select View Code, or double click the sheet in the Microsoft Excel Objects list in the VBA environment to get to the sheet module.
This page should give more insight.