You have the macro in the code module for the worksheet. Try putting it in a standard module.