or your code is in the Thisworkbook module of a workbook that doesn't contain a Sheet3 in which case the code always refers to the workbook containing the code no matter which workbook is active