I think I see the problem... on the .Sort line you are using the same unsafe coding style that Excel records macros in (eg: Range("H2") , etc), rather than the proper syntax as you've got on the first line of your code (which would make it: Sheets(1).Range("H2") , etc).