Thisworkbook refers to the workbook that contains the code, you need activeworkbook instead