I'm quite surprised the macro works on its own since there is a
problem with this line:
Cells("A1").Select
The Cells statement wants to see (row,column) values after it rather
than "A1" or some such. Change the code to either:
Range("A1").Select
or:
Cells(1,1).select