You pasted the code into a standard module, right - not the workbook or worksheet module...