A subscript out of range error is related to the sheet names in the code not matching with the sheet names in the file. Ensure that the sheet names match and then run the code. It should work.